android - open activity from 2 different notification -


i build notification in chat apps, , receive 2 notification usera , userb. when click notif usera, open conversationactivity between me , usera. while conversation between me , usera still open click notif userb, , i've got still in conversation between me , usera not userb. when build notif

private notificationcompat.builder createtypenotif(string message, getcntcresp contact){         notificationcompat.builder builder = new notificationcompat.builder(serv.this);         string[] parts = splitmessage(message);         if (parts.length > 1){             if (parts[0].equals(serv.chat_protocol) || parts[0].equals(serv.loc_protocol)){                 resultintent = new intent(serv.this, classchat.class);                 resultintent.setflags(intent.flag_activity_clear_top | intent.flag_activity_single_top);                 resultintent.putextra(classchat.class.getsimplename() + ".empid", contact.getempid());                 resultintent.putextra(classchat.class.getsimplename() + ".message", message);                 builder.setsmallicon(r.drawable.ic_notif_chat)                         .setcontenttitle("incoming message")                         .setcontenttext("you got message " + contact.getname());                 builder.setlargeicon(bitmapfactory.decoderesource(getresources(),r.mipmap.ic_launcher));                 return builder;             }else{                 return builder;             }         }else{             return builder;         }     } 

use flag start activity instead of single top. intent.flag_activity_new_task learn more here


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -