I am using intents to save data and retrieve other places in my application. I have used them in other places, but now, it is not working as expected.
Public category GCMIntent Services GCMBCIntent Services {Public GCMIntent Service () (Superstance GCM.GCM_SSNNAIDID); } @ Override Secure On Zero Message (Reference Reference, Intent of Intent) {... String NS = Reference NETIFICATION_SERVICE; Notification Manager Manager = (Notification Manager) context.getSystemService (ns); String Room = Intent. Get Extras (). GetString (ConstantsGCM.GCM_ROOM); Not intent; Pending delegation included; Notification Notification; Notif = new notification (icon, textstats, time); NotIntent = new intent (contexto, RoomsActivity2.class); Bundle B2 = New bundle (); B2. Putstring (Stabilization, Room, Room); NotIntent.putExtras (B2); ContIntent = Pending.teactivity (pattern, 0, not intent, 0); Notif.setLatestEventInfo (contexto, tittle, description, contIntent); Notif.flags | = Notice FLAG_AUTO_CANCEL; NotManager.notify ((int) (Math.random (* * 1000), notif); An alert is coming when this code is executed. When I click on this notification, then this activity room mechanism 2. I execute the class I here, I just call this code:
public string getMessageString (string cod) {string result = ""; Bundle = getIntent (). GetExtras (); If (bundle! = Null) {result = bundle.gate string (cod); } Return results; } But, I did not get the final data saved in the intestine. What's wrong with that? I think I am not using it properly Why can not I get data from activity?
What do I think is happening: The application receives too much information, first one does the right thing, but, if I get more information, then the data is not overridden and I always have the first Times, though, when I debug the code, I'm setting another data.
OK, it's been a while since I've worked with pending intentions, but give me Remember things:
Replace:
contIntent = PendingIntent.get Activity (Pattern, 0, notIntent, 0); With :
contIntent = pending content Gate activity (Contaxo, 0, Notintent, PendingEntent.FLAG_UPDADARTTNT); This will keep the bundle around.
But this flag will override any existing pending intent with the latest, you probably do not want it.
If you have multiple pending intents with the same reference (but different bundles!) From the same context, then you can use 2 parameters.
contIntent = PendingIntent.getActivity (contexto, requestCode, NotIntent, pending agent.FLAG_UPDATE_CURRENT); Unless each pending intent is a unique requestcode , and even if the google dev docs says that the parameter has not been used, Serves one purpose to identify pending intentions and allows duplicate with different bundles.
No comments:
Post a Comment