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
13
votes
8 answers

Adding Geofence gives ApiException status 13

Recently run into a problem where adding geofences will randomly fail with an ApiException, status code 13 which is defined as "ERROR" no extra details provided. Normally the error codes are specific to geofencing, but this seems to be a generic…
13
votes
2 answers

Pendingintent getbroadcast lost parcelable data

Here is the problem. My program is running perfect in Android 6.0. After update the device to android 7.0. Pendingintent can not pass the parcelable data to boradcast reveiver. Here is the code. Fire the alarm public static void setAlarm(@NonNull…
13
votes
3 answers

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…
mobibob
  • 8,670
  • 20
  • 82
  • 131
13
votes
2 answers

When to use IntentSender vs. PendingIntent?

The Android documentation describes both PendingIntent and IntentSender classes but it's not clear when or why you would use an IntentSender over a PendingIntent -- in fact much of the description appears to be identical for both. The PendingIntent…
Alan
  • 1,148
  • 1
  • 9
  • 17
13
votes
3 answers

PendingIntent from second action overwrites the first action and the contentIntent for Notification

The code: int id = 0; NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(context.getString(R.string.notification_on_the_move_gps_title)) …
Saran
  • 3,845
  • 3
  • 37
  • 59
13
votes
2 answers

Android application current activity bring to front issue

I have a basic question for which I don't think attaching any code-snippet may help. When we press home button while an app is in front we go to the home page and the app loses its focus. Now, My application has to have notification icon in the…
Mustofa Rizwan
  • 10,215
  • 2
  • 28
  • 43
12
votes
0 answers

IllegalStateException AlarmManager Maximum limit of concurrent alarms 500 reached on Android 10

Using alarms with pending broadcasts, this was working as intended until recently a crash started appearing for RealMe devices running on Android 10 and few OPPO devices running on Android 7.1.1 Crash : IllegalStateException: Maximum limit of…
rd7773
  • 409
  • 3
  • 13
11
votes
3 answers

In flutter app Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent

Please help me to sort out the problem. I give a link to the git. https://github.com/Vasajj/radio_tysa_fm.git something is wrong with PendingIntent, with package: On android 8 all is fine Installing build\app\outputs\flutter-apk\app.apk... Debug…
Vasyl
  • 154
  • 1
  • 1
  • 9
11
votes
4 answers

Missing mutability flags: Android 12 pending intents with NavDeepLinkBuilder

I´ve started testing my app for issues on Android 12, and have had some warnings regarding mutability flags on pending intents that are set up for a home screen widget. These mutability flags are now mandatory from SDK 31. Before 31, this code would…
11
votes
3 answers

Android 12 Pending Intent Immutable flag not available under API 23

Similar to this question, but not the same After update to Android 12 (SDK 31) we change PendingIntent.getActivity(context, 0, intent, 0) to PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_IMMUTABLE) like suggested. But…
Canato
  • 3,598
  • 5
  • 33
  • 57
11
votes
1 answer

Multiple OnClick on Widget for the same Intent

My Widget starts a Service and the Service Update a List of 3 LinearLayouts. I want to set on each LinearLayout a SetOnClickPeningIntent with different Extra But when i start the widget and want to click on the LinearLayouts only the last one is…
Stefan
  • 195
  • 1
  • 7
11
votes
3 answers

RecognizerIntent: how to add a bundle to a pending intent

I am implementing an activity that responds to the RecognizerIntent. Among others this activity must handle two incoming extras that specify a pending intent and its…
Kaarel
  • 10,554
  • 4
  • 56
  • 78
11
votes
1 answer

Android, clicking on notification group

I have a group of notifications in Android App. I need my application to know if the app was opened when the user clicked on the notification. I have used a pending intent and it works brilliantly. But how can I check if the user has clicked on the…
Yakov Kemer
  • 373
  • 3
  • 17
11
votes
1 answer

Android AlarmManager problem with setting & resetting an alarm

I use an Alarm to fetch data from server. I like to give user the option to start and stop the alarm. This means I have to check and see if alarm is already set. I found some code that tells me if the alarm is already set: Intent I = new…
11
votes
1 answer

What happens if you set the flag on a PendingIntent to 0?

What exactly happens when you set the flag on a pending intent to 0? Does it just not raiise a flag or does it default to one of the others?
ninjasense
  • 13,756
  • 19
  • 75
  • 92