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
3 answers

Incorrect timestamp on future notifications

When my application is launched, it performs an API call and then schedules notifications based on the results. This amounts to around ~10 notifications being scheduled. There seems to be an issue with the timestamp displayed on the actual…
7
votes
1 answer

BroadcastReceiver is not called after createChooser(context,intent,IntentSender) is executed

I want to detect what app the user selects after I present him with a createChooser() dialog. So I have created my BroadcastReceiver subclass like this: import android.content.BroadcastReceiver; import android.content.Context; import…
7
votes
6 answers

Adding android progress dialog inside Background service with AsyncTask,Getting FATAL Exception

Iam calling a Asynctask from Scheduled Service Every 10 mins it will Run. while running the Service, Progress dialog getting Exception from OnpreExecute. ERROR : FATAL EXCEPTION: main …
7
votes
3 answers

Pending intent with different intent but same ID

I have two pending Intent to use with Alarm Manager one is: Intent i = new Intent(context, TriggerAlarm.class); PendingIntent pi =PendingIntent.getBroadcast(context,0,i,PendingIntent.FLAG_CANCEL_CURRENT); and the other is: Intent i = new…
mj7000
  • 73
  • 6
7
votes
1 answer

Start Activity with backstack

I'm trying to start an activity and at the same time correctly maintain a backstack to allow the user to use the back button. To do so, I'm following Google's instructions, but am getting nowhere. When I click my button, nothing happens (except the…
AndroidDev
  • 20,466
  • 42
  • 148
  • 239
7
votes
1 answer

FusedLocationApi with PendingIntent for background location updates. Unable to receive updates

The sample source code from google was to easy to implement continuous location updates on frontend, but I still can;t get or understand clearly how the background location updates work using FusedLocationApi and PendingIntent. LocationService…
7
votes
1 answer

Android : Create a single task with multiple applications' activities (Lauchmode issue)

I don't know how to tackle this Android issue. In few words, the flow between my 2 applications is as below : Flow Bind Application A to a service in Market application (AIDL) Register a BroadcastReceiver and call a service method that returns a…
johann
  • 1,115
  • 8
  • 34
  • 60
7
votes
2 answers

Multiple Pending Intents?

My activity creates a couple of notifications. Here's how I'm currently doing it, on different resultIntents: PendingIntent resultPendingIntent = PendingIntent.getActivity( context, 0, resultIntent, …
Sid Verma
  • 536
  • 1
  • 7
  • 25
7
votes
4 answers

Cancel all the alarms set using alarmmanager

I want to cancel all the alarms that are set. I have searched a lot and tried a lot of things but nothing worked. When I set an alarm for say after 2 minutes and then I cancel it, it will still fire after 2 minutes. The method used to create the…
7
votes
2 answers

How to open the main app from the wearable?

I'm playing a little with wearables, I already created notifications from my micro app (which runs on the wearable) with some little restrictions and I'm wondering how I can create a pending intent for an action to open the main app on the phone.
7
votes
1 answer

Intent with old extra in onCreate() for singleTask Activity

For example I created project with 2 activities: FirstActivity with android:launchMode="singleTask" flag and SecondActivity. At first user starts FirstActivity and after this SecondActivity will start on button click. From SecondActivity we create…
7
votes
1 answer

Android Geofencing - No coming intents?

I have a strange problem. I implemented geofencing using Google Services. (Implementation below) On my devices (Samsung Galaxy S and Moto X) they work perfect. On some other devices (HTC Incredible S, Galaxy Note), I receive no transition intents.…
7
votes
2 answers

What happens to the alarms set via alarm manager by an app, if the app is uninstalled

I have the below code to set up an alarm from my app. Intent intent = new Intent("MY_ALARM_NOTIFICATION"); intent.setClass(myActivity.this, OnAlarmReceive.class); intent.putExtra("id", id); PendingIntent pendingIntent =…
tony9099
  • 4,567
  • 9
  • 44
  • 73
7
votes
1 answer

Reading an NDEF message from an NFC tag from an Android application

I am trying to create an application using NFC and I just want to try and read an NFC tag and get the text message from the tag and place it into a TextView. I have code for it already, but nothing happens when I try to pair the phone with an NFC…
James Meade
  • 1,147
  • 5
  • 22
  • 46
7
votes
2 answers

Android - Why use pending intents for geofences

I just finished the tutorial for geofencing on Android (http://developer.android.com/training/location/geofencing.html) and I wonder why the 'callback' for geofences are done via pending intents and not a simple callback interface. If implemented in…
Flo
  • 1,469
  • 1
  • 18
  • 27