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
7
votes
4 answers

Determine if Activity is called by a Notification

I am using an Activitiy with various Tabs on it. From a different part of the application, Notifications are created to tell the user that something has changed. I now managed to Call the Activity, when the user clicks on the Notification. But how…
dognose
  • 20,360
  • 9
  • 61
  • 107
7
votes
3 answers

AlarmManager when the phone is turned off - ANDROID

I'm doing an alarm System but i've a problem when the phone is turned off.. The alarm doesn't work.. I'm setting de alarm as follows: public void doIntents(Context context, long milis, Tratam trat){ cal=Calendar.getInstance(); …
7
votes
1 answer

How to send an ordered broadcast in a PendingIntent?

I want to send an ordered broadcast in a PendingIntent. But I've only found PendingIntent.getBroadcast(this, 0, intent, 0), which I think can only send a regular broadcast. So, what can I do?
user1455175
  • 71
  • 1
  • 3
6
votes
2 answers

Second notification is not working

I try to create multiple notifications. If click on the notification, it will link to another Activity. After following code, it's create two lines of notification. But when I click to the first line of notification, it's not working. Only second…
Yoo
  • 1,421
  • 8
  • 20
  • 36
6
votes
5 answers

App starts to crash after upgrade to SDK 31 Android

Edit I removed Appodeal, explorestack:consent and jcenter and now it works. Appodeal did not build without jcenter which is deprecated. I am not really sure where the problem lies, but one of the above should be the problem. I recently updated the…
El_Loco
  • 1,716
  • 4
  • 20
  • 35
6
votes
1 answer

Why does my Intent open App Info in Settings for my app, rather than the Activity class I pass to it?

I have an Activity which starts a foreground Service with a Notification. If relevant, the Service may also be set to start on boot, ie. I expect it to be able to start without the Activity also. I want it to be so that if I tap the Notification,…
6
votes
3 answers

Intent in Notification does not change

I have an alarm receiver that does some checks and then creates a Notification for each check. This means it can create more than one Notification. This all works fine. However, I have an Intent connected to the notification to start an activity…
Bart Friederichs
  • 33,050
  • 15
  • 95
  • 195
6
votes
4 answers

Launching Intent from notification opening in picture-in-picture window

I've followed the Android picture-in-picture documentation. That is to say, my PiP activity is marked android:launchMode="singleTask", android:resizeableActivity="true", and…
6
votes
0 answers

Setting Pending Intent to Builder in Onesignal NotificationExtenderService doesn't get Detected

I want to call Webview_activity on Notification Tap when app is killed , so in NotificationExtender Service ive attached Pending intent with the builder using setContentIntent() method, but nothing happens when notification is…
Karan Gada
  • 65
  • 7
6
votes
3 answers

Invalid activities specified in the ActivityTransitionRequest

I'm trying to use ActivityRecognition. However I get an error when i'm trying to get a transition update for DetectedActivity.TILTING or DetectedActivity.UNKNOWN. For all the other activity types I don't have problems. Here is my code to create the…
6
votes
0 answers

Relation between AlarmManager and INTERACT_ACROSS_USERS

We recently integrated with Crashlytics in Firebase and found that our app was facing this crash: Fatal Exception: java.lang.SecurityException get application info: Neither user 1010170 nor current process has…
6
votes
1 answer

Android - Notification pendingIntent to Stop Service

I have two notification actions, one to stop the service and one to restart it. I am successfully starting the service but I can't stop it with this code: PendingIntent show = PendingIntent.getService(this, 1, svc,…
Code Poet
  • 6,222
  • 2
  • 29
  • 50
6
votes
1 answer

What happens to PendingIntents when user updates the app?

I know that the data, like in sharedprefs files, doesnt get erased when a user updates his app, but what about a scheduled Broadcast? Does the PendingIntent get canceled?
John Sardinha
  • 3,566
  • 6
  • 25
  • 55
6
votes
4 answers

How to restart / refresh contents of activity on notification click

I am trying to refresh the contents of an activity on click of a notification. I can navigate to the activity when I am in some other activity and I click on the notification. What I am trying to achieve is, I am in Activity A which is displaying…
6
votes
1 answer

Adding flags to PendingIntent

when we pass 0 as flag to PendingIntent as below : PendingIntent pi=PendingIntent.getActivity(this, 1, i, 0); does it follow any flags rules means does 0 correspond to any flag by default. If we create another PendingIntent as PendingIntent…
user2779311
  • 1,688
  • 4
  • 23
  • 31