eclipse - Java/Android: passing Intent extras from BroadcastReceiver to Activity -


update: neither eclipse nor code did cause these trouble. genymotion did.

maybe approach wrong, since no 1 else seems have problem - if so, open try different ways rather fix problem: have following setting.

a broadcastreceiver listening installations of apps. whenever new app installed, create notification, using pendingintent based on normal intent via

pendingintent pintent = pendingintent.getactivity(context, 0, notificationintent, 0); 

before pendingintent created, put extras in normal intent, shall passed activity triggered, when notification clicked.

notificationintent.putextra("applabel", applabel); // installed app notificationintent.putstringarraylistextra("group", group); // corresponding group notificationintent.putstringarraylistextra("list", list); // corresponding list 

now works fine , notification displayed. debugging can see, when pintent created, extras set correctly , passed. however, when try read extras in opened activity trouble starts. had build workaround, based on answer here, read extras:

bundle bundle = getintent().getextras(); (string key : bundle.keyset()) {   object value = bundle.get(key);   if (key.equals("group")) {    group = (arraylist<string>) value;   } ... } 

this worked time, lost. reason, arraylist extras empty [] - applabel still set correctly.

now real trouble is, not sure if code related, or eclipse issue.

i observed, after deployments, bundle.keyset() returned different keys had set in putextra call. encounter outofsync errors when search. refreshing times, regarding names of keys, values lost still.

to has read this: many thanks! - has clue, going on here? know similar eclipse problems? or there error in code? proposals different design welcome well. i'd glad, if can exclude error sources... in advance

update: manifest infos: launched notification activity defined like:

<activity  android:theme="@style/theme.appcompat.compactmenu.dialog"  android:label="notification receiver"  android:excludefromrecents="true"> </activity> 

the mainactivity has name , label. besides:

<uses-sdk android:minsdkversion="18" android:targetsdkversion="19" /> 

i added systemout @ 2 points: 1 when intent created bcr, 1 when read activity.

broadcastreceiver.getextras.keyset returns [a,b,c,d]  activity.getextras.keyset returns keys [x,y,z] 

searching in projects , workspace, x,y,z found... used in previous version of days ago, seems eclipse stored invalid old data?

well, looks technical stuff , outofsync nasty, in end not relevant. covered trivial mistake. answere can found here: incorrect extras received intents first one

at least current implementation, looks solving problems - except sync issues of course has not occured again.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -