pendingintent

Dropping PendingIntents

Is it ok to drop PendingIntents in android if they are never used. Such as in an AppWidgetProvider where a PendingIntent that was never used be overwritten by a new PendingIntent. Or should we call cancel on all unused PendingIntents to clean up memory appropriately? ...

Android: Adding data to Intent fails to load Activity

I have a widget that supposed to call an Activity of the main app when the user clicks on widget body. My setup works for a single widget instance but for a second instance of the same widget the PendingIntent gets reused and as result the vital information that I'm sending as extra gets overwritten for the 1st instance. So I figured tha...

PendingIntent in Widget + TaskKiller

Hi, I've developed an Application (called Instant Buttons) and the app has a widget feature. This widget uses PendingIntent for the onClick of the widget. My PendingIntent code is something like this: Intent active = new Intent(context, InstantWidget.class); active.setAction(String.valueOf(appWidgetId)); active.putExtra("b...

I need help with Widget and PendingIntents

Hi, I've asked here a question about Task Killers and widgets stop working (SO Question) but now, I have reports of user that they don't use any Task Killer and the widgets didn't work after a while. I have a Nexus One and I don't have this problem. I don't know if this is a problem of memory or something. Based on the API: A Pendi...

Multiple calls to AlarmManager.setRepeating deliver the same Intent/PendingIntent extra values, but I supplied different ones

Solved while writing this question, but posting in case it helps anyone: I'm setting multiple alarms like this, with different values of id: AlarmManager alarms = (AlarmManager)context.getSystemService( Context.ALARM_SERVICE); Intent i = new Intent(MyReceiver.ACTION_ALARM); // "com.example.ALARM" i.putExtra(MyReceiver.EXTRA_ID...

When is advised PendingIntent vs. LocationListener on requestLocationUpdates?

you can subscribe to requestLocationUpdates via two ways one by specifing a PendingIntent the other is by using a LocationListener When is advised the one and when the other? ...

PendingIntent works correctly for the first notification but incorrectly for the rest

protected void displayNotification(String response) { Intent intent = new Intent(context, testActivity.class); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, Intent.FLAG_ACTIVITY_NEW_TASK); Notification notification = new Notification(R.drawable.icon, "Upload Started", System.currentTimeMillis(...

Android Pending intent started from notificaion does'nt replace the last

I've read many posts on the same topic and tried all the given solutions without getting the result I want. The program should start an intent with extras from a notification: NotificationManager mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); Intent notificationIntent = new Intent(...

How to do nothing after using SMSManager.sendTextMessage

In my program I have a dialogue-themed activity that pops up with an edittext and submit button that sends an sms message. After the message is sent I want the phone to go back to whatever activity it was doing before (the dialogue is started by a broadcast receiver) however SMSManager's sendTextMessage(...) method takes a pending inte...

Why is my android alarm manager firing instantly?

I am following sample code for sending an update notification every 10'seconds. The code follows and it is in an "UpdateService" for an AppWidgetProvider. If I put a Thread.sleep(10*1000); I can see the expected behavior of my servicing loop. I obviously have something fundamentally wrong that is triggering immediately. It is suppose...

Post Intent action from widget provider

I want to build a search widget. Clicking on the widget should open search activity inside my app. Here is the code from widget provider's onUpdate(). public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { /* as their may be many widget instances for this widget. we get an array. */ for(i...

Android widget intents

I have a widget class and a service class updating the widget. I have added in the widget class in onUpdate() the following code: RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.countdownwidget); Intent Intent1 = new Intent(Intent.ACTION_MAIN); Intent1.addCategory(Intent.CATEGORY_LAUNCHER); PendingIntent ...

Calling startActivity() from outside of an Activity?

Hi all, I'm using an AlarmManager to trigger an intent that broadcasts a signal. The following is my code: AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(this, Wakeup.class); try { PendingIntent pi = PendingIntent.getBroadcast(this, 0, i, 0); Long elapse...

RemoteViews and setOnClickPendingIntent

I try to write my first widget application and i got a problem. So, i have 2 arrows: switch to left and switch to right. For both of them I want to use a single Service, which changes the view of my homescreen widget according direction of arrow. For distinguish the direction of arrow i put an extra data to each intent i use. This is my ...