Questions tagged [android-pendingintent]

An Android class that provides a description of an Intent and target action to perform with it

From the PendingIntent API:

A description of an Intent and target action to perform with it. Instances of this class are created with getActivity(Context, int, Intent, int), getActivities(Context, int, Intent[], int), getBroadcast(Context, int, Intent, int), and getService(Context, int, Intent, int); the returned object can be handed to other applications so that they can perform the action you described on your behalf at a later time.

By giving a PendingIntent to another application, you are granting it the right to perform the operation you have specified as if the other application was yourself (with the same permissions and identity). As such, you should be careful about how you build the PendingIntent: often, for example, the base Intent you supply will have the component name explicitly set to one of your own components, to ensure it is ultimately sent there and nowhere else.

Useful links

1881 questions
24
votes
2 answers

Is it possible to create multiple PendingIntents with the same requestCode and different extras?

I'm using AlarmManager to schedule anywhere between 1 and 35 alarms (depending on user input). When the user requests to schedule new alarms, I need to cancel the current alarms, so I create all of my alarms with the same requestCode, defined in a…
Snailer
  • 3,777
  • 3
  • 35
  • 46
23
votes
5 answers

How to create different pendingintent so filterEquals() return false?

I'm using AlarmManager to set up repeating intents but it has caused some little troubles so hope anyone could help. Summary There are 2 pending intents. One runs at 1000 and another runs at 2000 every day. Each contains a row id from the database…
markbse
  • 1,023
  • 3
  • 13
  • 26
22
votes
6 answers

Android Notification restarts app but want to resume

Hi I have a been able to get a notification displayed for my activity, and when the user clicks the notification the app restarts. However I just want it to reappear not restart. eg. it is a web app and I want it to come to the front when the…
ozmike
  • 2,738
  • 1
  • 33
  • 40
22
votes
5 answers

Intent to resume a previously paused activity (Called from a Notification)

I'm developing an app which shows a notification to the user. The notification's objective is to make it easy to the user to return to the activity when the user is in another activity. I am using this code in my app to create and show the…
Jimix
  • 1,539
  • 3
  • 15
  • 20
22
votes
3 answers

putExtra using pending intent not working

I have written a code in my GCMIntentservice that sends push notifications to many users. I use the NotificationManager that will call DescriptionActivity class when the notification is clicked. I also send the event_id form the GCMIntentService to…
21
votes
1 answer

How to launch a new activity using pending intent

Can anyone please say how to launch a new Activity using PendingIntent and also to pass a value using pending intent. Thanks in advance.
Ashish Augustine
  • 1,784
  • 4
  • 20
  • 50
21
votes
3 answers

How to send data through PendingIntent to Broadcast?

I'm trying to send via PendingIntent some extra data, like: MyMessage message; //... Intent intent; SmsManager sms = SmsManager.getDefault(); intent = new Intent(Constants.SENT_PLAIN); intent.putExtra(Constants.EXTRA_RAW_ID, message.getId());…
Barmaley
  • 16,638
  • 18
  • 73
  • 146
21
votes
1 answer

Android PackageInstaller, re-open the app after it updates itself

I'm developing an app that runs as Device Owner, and I want to build an automatic updater inside it. To do it I use the PackageInstaller, as I have the privileges to use it due to my Device owner position. private void installPackage(InputStream…
21
votes
2 answers

Notification with "null" PendingIntent

I'm trying to implement notification in Android. Now I have a problem, I don't want to have a PendingIntent that user will open any Activity. How can I do that?
peterlawn
  • 2,371
  • 6
  • 25
  • 44
21
votes
1 answer

Can you use pending intents with localbroadcasts?

I am interested in using pending intents with local broadcasts. To make myself clear, I am using the following for registering receivers and sending broadcast: android.support.v4.content.LocalBroadcastManager. I have a local broadcast receiver in a…
Nims
  • 477
  • 1
  • 5
  • 12
20
votes
1 answer

How does AlarmManager.AlarmClockInfo's PendingIntent work?

I am trying to use AlarmManager.AlarmClockInfo to set an alarm. The constructor to this takes the time and a PendingIntent which is described in the docs as: an intent that can be used to show or edit details of the alarm clock. and then…
An SO User
  • 24,612
  • 35
  • 133
  • 221
19
votes
1 answer

Cancelling a PendingIntent

When using a PendingIntent in an AppWidgetProvider, I'm using the following code: views.setOnClickPendingIntent( viewId, PendingIntent.getBroadcast( context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT ) ); So…
Roger Rapid
  • 956
  • 1
  • 8
  • 28
19
votes
2 answers

How to get Intent from PendingIntent

Can I get the Intent from a PendingIntent? Here is the scenario: I create an Intent (let's call it myIntent) I put some Extra information with a String (call it myInfo) I create a PendingIntent (myPendingIntent) using myIntent I set an alarm using…
Lefteris
  • 873
  • 2
  • 8
  • 29
19
votes
2 answers

How to stop an alarm in android

In my main activity which has a button in it. In its onclick listener im calling function to set alarm.The alarm is working but iam not able to stop it .Can some one help me MainActivity.java public class MainActivity extends Activity { …
playmaker420
  • 1,527
  • 4
  • 27
  • 52
18
votes
2 answers

Didn't include a pendingIntent in the extras?

I came across this Error message on Logcat while working on an app. Can anyone tell me what it means? 07-24 23:34:20.288 1140-1140/? E/NetworkScheduler.SchedulerReceiver﹕ Invalid parameter app 07-24 23:34:20.288 1140-1140/?…
Mallock
  • 515
  • 1
  • 4
  • 12