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
6
votes
1 answer

Android - how to open a push notification deep-link intent that, when closed, returns to the Home screen?

I've created a receiver to receive and display push notifications - when the user presses on the push notification it opens a deep-link within my application. The problem is that when the user presses "back" he doesn't exit back to the home screen,…
Jon
  • 7,941
  • 9
  • 53
  • 105
6
votes
2 answers

Geofences not triggering (pendingintents and broadcastreceiver)

I've used the Android tutorial with Geofences which, obviously, doesn't work when app is closed. So, after searching around, I've noticed user b-ryce on SO used BroadcastReceiver so geofences get triggered even if app is not active (link for his SO…
gregor
  • 609
  • 1
  • 7
  • 15
6
votes
2 answers

Notification DeleteIntent broken on later versions of Android

In our app OneBusAway Android (open-source on Github), we need to be notified when the user dismisses a particular reminder notification, so we don't post another reminder notification for the same event (how long until their bus arrives). We're…
6
votes
3 answers

Android PendingIntent FLAG_NO_CREATE does not return null

I have some trouble with PendingIntents. Every time my app is opened it will schedule some broadcasts. My Problem is that already existing PendingIntents aren't recognized. I know that the PendingIntents and the unterlaying Intents must be created…
6
votes
2 answers

finish activity in which a pending intent starts

In my app, i created a custom notification that contain a button that show recent apps(instead of home button long press) when user open main activity and press home button to go to home screen then drag the notification drawer and click on the…
6
votes
1 answer

Creating a Notification at a particular time through Alarm Manager

I am trying to create a notification at a particular time. Im creating a broadcast receiver and calling it through the AlarmManager. Problem is that the broadcast is not received and that I am not getting any notifications. Registering the…
6
votes
1 answer

Launch a fragment in my Android application from the notification bar

How do I start a fragment in my Android application from a notification in the notification bar? I've tried to implement this answer of creating my own action and then setting the action to the intent, but I'm unsure how to use it and what is…
6
votes
0 answers

Custom TaskStack finishes parent activity from notification

I'm having problems with using TaskStack for notifications. I'm trying to keep the navigational flow of my app when a notification is tapped. The navigation style of my app is like: PrincipalActivity (parent) → SecondaryActivity (child) Sometimes a…
6
votes
1 answer

Pending intent extras are received only when activity is paused

I'm sending extra string with pending intent from my StateCh.java to MainActivity. My expectation on it is to display dialog in MainActivity when pending intent with extra is arrived (notification is clicked). The problem is when i open the…
XorOrNor
  • 8,868
  • 12
  • 48
  • 81
6
votes
2 answers

Android PendingIntent extras, not received by BroadcastReceiver

When I pass extras to a PendingIntent, the message is never received by the sendBroadcastReceiver, because the onReceive() method of this BroadcastReceiver is never called. Why is this happening? public class MainActivity extends Activity { …
Etienne Lawlor
  • 6,817
  • 18
  • 77
  • 89
6
votes
3 answers

Android ListView in widget onClick not working

I'm trying to make the listrows in my ListView Widget clickable by using the setOnClickFillInIntent method but whenever I click a ListItem nothing happends. Here are some key parts of my code: Intent i = new Intent(); Bundle extras = new…
6
votes
1 answer

How to get requestCode from pending intent at the time of alarm in android

Is it possible to get requestCode at the time of intent either in Receiver class or Activity Class? and this was my pending Intent alarmMgr= (AlarmManager)getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(this,…
6
votes
2 answers

Android Widget stops working randomly

I have been working with this problem for three days now and I've looked at every single question on here for an answer. I have a widget with a button on it and all I would like it to do is start a service everytime it is clicked. The problem is…
6
votes
1 answer

relaunching the app fails android

I have an application in which i am generating a lot of notifications from a service.For each notification i have pending intent.Also pressing the home button stops my entire application and service using the following code System.exit(0); Firing…
hacker
  • 8,919
  • 12
  • 62
  • 108
6
votes
1 answer

Has requestCode in PendingIntent always been supported?

I'm trying to distinguish between different instances of PendingIntent by having separate requestCode for each use-case as suggested by this earlier question. Is this a robust solution? Has requestCode always been supported even though the javadocs…
Hrushikesh
  • 327
  • 3
  • 6