a while back i posted an issue i was having when my BroadcastListener was listening for phone state and sending the info over to an Activity which would present UI. but getIntent() in the receiving Activity always brought back the initial one. should i be using something off PendingIntent in that case too?
thanks >You should be using PendingIntent.getBroadcast() instead of getActivity(). :) > >j > >On Wed, May 20, 2009 at 3:23 AM, Alan Jones <skyp...@gmail.com> wrote: >> >> Hi All, >> >> I've had an issue where no matter how I've tried to set it up I'm >> finding the BroadcastReceivers aren't receiving any PendingIntents. A >> look through LogCat confirms that the intents are launched, but >> they're not being executed. >> >> I managed to make a simple(ish) repro case. If you take the >> SimpleWiktionary widget by Jeff Sharkey >>http://code.google.com/p/wiktionary-android/ >> and make the following changes plus any required imports. >> >> Replace the Service's onStart with this >> <code> >> public static class UpdateService extends Service { >> @Override >> public void onStart(Intent intent, int startId) { >> // Build the widget update for today >> RemoteViews updateViews = buildUpdate(this); >> >> // Push update for this widget to the home screen >> ComponentName thisWidget = new ComponentName(this, >> WordWidget.class); >> AppWidgetManager manager = AppWidgetManager.getInstance >> (this); >> manager.updateAppWidget(thisWidget, updateViews); >> >> Context context = getBaseContext(); >> long nextAlarm = System.currentTimeMillis() + 15000; >> Intent alarmIntent = new Intent(context, WordWidget.class); >> PendingIntent pendingIntent = >>PendingIntent.getActivity(context, >> 0 /* no requestCode */, >>alarmIntent, 0 /* no flags */); >> >> AlarmManager alarmManager = (AlarmManager) >> context.getSystemService(android.app.Activity.ALARM_SERVICE); >> alarmManager.set(AlarmManager.RTC_WAKEUP, nextAlarm, >> pendingIntent); >> >> } >> </code> >> >> and add an override to onReceive like this >> <code> >> @Override >> public void onReceive(Context context, Intent intent) { >> final String action = intent.getAction(); >> Log.d("WordWidget", "Action: " + action); >> >> super.onReceive(context, intent); >> } >> </code> >> >> Then add the widget to your desktop and watch LogCat. After 15 seconds >> you'll see the intent getting launched, but nothing logged with the >> tag WordWidget. >> >> I've got no idea what I've done wrong, anybody having a "well, there's >> your problem." moment? >> >> Cheers, >> >> Alan. >> > >> > > > >-- >Jeff Sharkey >jshar...@android.com > > -- jason.software.particle --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---