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
11
votes
2 answers

Alarm Manager issue in Android 6.0 Doze mode

I've made an app that always worked until Android 6.0. I think it's the Doze feature that it's not allowing my Alarm to fire. I use sharedpreferences to handle the options: //ENABLE NIGHT MODE TIMER int sHour =…
11
votes
3 answers

Android: Part of my extras are getting lost in pending intent

I am making an Android app for the first time and I am having this problem. When a user A sends a friend request to another user B, user B gets a notification. I wish when the user B click on the notification to be redirected to user A profile. The…
11
votes
3 answers

Android Pending intent started from notification doesn't 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 =…
Emil
  • 1,414
  • 1
  • 12
  • 14
11
votes
4 answers

Will AlarmManager work if my application is not running?

I have an alarm that works fine if i am interacting(using) with my application but it dose not works if I set it for next day and not interacting with my app.Therefore I am getting doubt is this because my application process is not running at that…
Shakeeb Ayaz
  • 6,200
  • 6
  • 45
  • 64
10
votes
4 answers

Android 12 Pending Intent

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent…
Dark_Clouds_369
  • 658
  • 1
  • 6
  • 24
10
votes
5 answers

Issue with cancelling the AlarmManager - PendingIntent

I have an app which reminds people to do their tasks. So there is one PendingIntent, now the user can delete the alarm when he wants to. In this code, there is just one PendingIntent for multiple user alarms so I am confused on cancelling that…
Preethi
  • 101
  • 1
  • 1
  • 4
10
votes
2 answers

Use two pendingIntent on one view in Appwidget

I have a widget class (extending AppWidgetProvider), which has only one view (ImageView) in the widget's layout. When the user taps on widget, it updates and launches an activity with no problem. Also the widget updates every 30 minutes and activity…
RuNo280
  • 573
  • 4
  • 27
10
votes
4 answers

Remove data from notification intent

I have issue in intent of my launcher activity.Scenerio is: 1. Send intents form notification service to my launcher activity PendingIntent contentIntent = PendingIntent.getActivity(this, TripLoggerConstants.PENDING_TRIPS_NOTIFICATION_ID, new…
user2106897
  • 529
  • 1
  • 5
  • 11
9
votes
1 answer

Can a broadcastReceiver catch multiple broadcasts?

I am trying to create multiple proximity alerts but I cant get it to work... I think that the broadcast receiver gets overwritten and thus is handling only the last broadcast. So if I had two points close by only the one whose intent was created…
mixkat
  • 3,883
  • 10
  • 40
  • 58
9
votes
3 answers

How to reference a view in a customized notification

In the below posted code i am create a notification with a customized layout. the layout of the notification contains three action buttons. the problem i have now is, i can not reference any of the buttons in the code so that I can navigate to…
9
votes
1 answer

Tapping on a bundled notification doesn't trigger the PendingIntent

So in Nougat multiple notifications from the same app get automatically bundled into a group. I'm setting a PendingIntent with some extras on my notifications and if a specific notification is tapped, it launches a specific activity (deep…
Dennis K
  • 1,828
  • 1
  • 16
  • 27
9
votes
2 answers

Click on android notification icon does not trigger broadcast receiver

I have an app hooked with push notifications. When the user click on the notification, I want a broadcast receiver to be triggered instead of an activity. I looked at these threads and looks like this is perfectly possible and common. Android…
9
votes
1 answer

Notification with Multiple actions

I have this code to make the actions: Intent playIntent = new Intent(Intent.ACTION_VIEW); playIntent.setDataAndType(uri, path.contains(".jpg") ? "image/jpeg" : "video/mp4"); PendingIntent play = PendingIntent.getActivity(context, 1, playIntent,…
Rodrigo Butzke
  • 448
  • 4
  • 15
9
votes
1 answer

Send broadcast on notification click

I have an application which is basically a webview and GCM notifications. I want to achieve the following thing: If the user is in the app and receives a notification, when he clicks the notification I want the webview to load the url provided in…
9
votes
2 answers

Can I detect if Android has killed the application (task process) from a Notification Intent / PendingIntent?

The Android OS kills processes when it's low on memory. Scenario: Android kills the app process and I re-open it through either the Android launcher or the recent-task list (long press home button). I can check if Android killed my app process in…