android-pendingintent

PendingIntent in Widget + TaskKiller

℡╲_俬逩灬. 提交于 2019-12-24 11:07:40
问题 I've developed an Application (called Instant Buttons) and the app has a widget feature. This widget uses PendingIntent for the onClick of the widget. My PendingIntent code is something like this: Intent active = new Intent(context, InstantWidget.class); active.setAction(String.valueOf(appWidgetId)); active.putExtra("blabla", blabla); //Some data PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0); actionPendingIntent.cancel(); actionPendingIntent =

Push notification issue in Oreo 8.0

泄露秘密 提交于 2019-12-24 10:23:12
问题 After updating the app to 8.1 the notification was not shown and I fixed it. Now, pending intent is not working as expected. After receiving the notification, I am not able to navigate to the app if it is in background and if it is closed it is not launching. private void sendNotify(String messageBody) { Intent intent = new Intent(); intent.setAction(Constants.NOTIFY); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); int uniqueId = (int) System.currentTimeMillis(); Uri defaultSoundUri =

Cancel button on Notification to remove Notification

点点圈 提交于 2019-12-24 08:12:53
问题 I have a Notification that has a Progress Bar and a Cancel button. I am using Thread to increment the Progress Bar and the Cancel button is supposed to clear the notification. Here's the code for Notification remoteViews = new RemoteViews(getPackageName(), R.layout.customnotification); Intent intent = new Intent(this, LocationBroadcastReceiver.class); intent.putExtra("CancelServiceAndNotification","CancelServiceAndNotification"); intent.putExtra("ID",1); PendingIntent pendingIntent =

Unable to set proper Context to cancel alarmmanager

怎甘沉沦 提交于 2019-12-24 07:31:21
问题 I have created an alarm with a notification and a button to stop the alarm but it seems that there is some issue with the Context that I have to get in order to cancel the AlarmManager . I have researched a lot and I think I have applied most of the things I found but somehow can't get this to work. I am aware the PendingIntent has to be the same and it appears to me they are with the same request codes too. AlarmSlave.class - Sets Alarm public class AlarmSlave /*extends Service*/ { private

How to stop alarm from executing after PendingIntent has been received - Android

那年仲夏 提交于 2019-12-24 04:13:01
问题 Before closing this issue or marking as duplicate based on the title, it is different from the regular "cancel alarm using AlarmManager and PendingIntent" questions. I am capable of creating and cancelling pending intents, as long as they are set for a time in the future and haven't gone off yet. I'm testing this using the following terminal command to view the PendingIntent s before creating an alarm as well as after: adb shell dumpsys alarm Here is my code for scheduling alarms in my custom

How to stop alarm from executing after PendingIntent has been received - Android

左心房为你撑大大i 提交于 2019-12-24 04:12:22
问题 Before closing this issue or marking as duplicate based on the title, it is different from the regular "cancel alarm using AlarmManager and PendingIntent" questions. I am capable of creating and cancelling pending intents, as long as they are set for a time in the future and haven't gone off yet. I'm testing this using the following terminal command to view the PendingIntent s before creating an alarm as well as after: adb shell dumpsys alarm Here is my code for scheduling alarms in my custom

Current activities onResume() is not called when another Activity is launched from lock screen via notification

假装没事ソ 提交于 2019-12-24 02:14:47
问题 I have two activities Activity2 and TestActivity . Activity2 shows notification when launched. TestActivity is launched when notification is clicked. Below is the code of Activity2.java . import android.app.PendingIntent; import android.content.Intent; import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationManagerCompat; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import com.droidapp.apptest.R; public

Get Intent from PendingIntent causes SecurityException

佐手、 提交于 2019-12-24 01:56:14
问题 We have some old code that worked for a long time: public static Intent getIntent(PendingIntent pendingIntent) { Intent intent = null; try { Method getIntent = PendingIntent.class.getDeclaredMethod("getIntent"); intent = (Intent) getIntent.invoke(pendingIntent); } catch (Exception e) { // Log line } return intent; } We are now getting a security exception: java.lang.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.company.util.IntentUtils.getIntent

AlarmManager triggers PendingIntent too soon for the second time

一个人想着一个人 提交于 2019-12-24 01:54:35
问题 I have this code: set alarm: public void setAlarm() { Calendar Calendar_Object = Calendar.getInstance(); Calendar_Object.add (Calendar.DAY_OF_YEAR, 1); Calendar_Object.set(Calendar.HOUR_OF_DAY, 0); Calendar_Object.set(Calendar.MINUTE, 0); Calendar_Object.set(Calendar.SECOND, 1); Intent myIntent = new Intent(Main.this, AlarmReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(Main.this, 0, myIntent, PendingIntent.FLAG_CANCEL_CURRENT); AlarmManager alarmManager =

addProximityAlert works initially

梦想与她 提交于 2019-12-23 22:52:45
问题 I create a number of ProximityAlerts. It seems only the first works and sometime the second. They also seem to expire. I call this method to create a ProximityAlert: public boolean addProximityAlert(int id) { locationManager.addProximityAlert( latitude, longitude, POINT_RADIUS, PROX_ALERT_EXPIRATION, getPendingIntent(id) ); registerReceiver(new ProximityIntentReceiver(), getIntentFilter(id)); return true; } private PendingIntent getPendingIntent(int id) { Intent intent = new Intent(PROX_ALERT