android-pendingintent

Notification PendingIntent Intent extras are overridden by another notification

白昼怎懂夜的黑 提交于 2019-12-06 06:43:40
问题 When creating a new notification with a new PendingIntent, the extras in its intent override any previous notification's PendingIntent Intent extras. For example, lets say I create Notification1 with PendingIntent1, which has Intent1 and its extras. When I create Notification2 with PendingIntent2, which has Intent2 with its own different extras, Intent1 will now have the same extras as Intent2. Why is this happening? How do I work around this? 回答1: There are two ways to solve this: One is to

Alarm Manager is not activating broadcast receiver?

社会主义新天地 提交于 2019-12-06 06:19:33
I am working on an application inwhich I am using AlarmManager for scheduling things. My Alarm is set. But this Alarm does not invoke BroadcastReceiver written to catch the event. I have searched a great deal but I have not found anything that solves the issue. I am posting my code, please have a look and see if I am missing something. AlarmManagerClass: public class ScheduleMessageManager { Context context; PendingIntent sender; AlarmManager am; public ScheduleMessageManager(Context context) { this.context = context; } public void addAlram(int scheduledMessageID, long scheduledTime) { //

Geofence - problem in triggering 'GEOFENCE_NOT_AVAILABLE'

▼魔方 西西 提交于 2019-12-06 05:05:32
I do app with geofencing use and since I started to work with it I get to broadcastReceiver the transitions and when I turned off the GPS location I got an alert with code GEOFENCE_NOT_AVAILABLE and I started a service to reregister the geofences when I will turn on the GPS. Now I took a few days break and suddenly my broadcastReceiver doesn't get alerts when I turn off the GPS. I don't understand why? *when I enter/exit from location (like I defined in the geofences init) I trigger the alerts, the problem is just at the triggering of the GEOFENCE_NOT_AVAILABLE alert. I will glad if anyone can

Pendingintent getbroadcast lost parcelable data

爱⌒轻易说出口 提交于 2019-12-06 05:01:29
问题 Here is the problem. My program is running perfect in Android 6.0. After update the device to android 7.0. Pendingintent can not pass the parcelable data to boradcast reveiver. Here is the code. Fire the alarm public static void setAlarm(@NonNull Context context, @NonNull Todo todo) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(context.ALARM_SERVICE); Intent intent = new Intent(context, AlarmReceiver.class); intent.putExtra("KEY_TODO", todo); PendingIntent alarmIntent

How to open the main app from the wearable?

☆樱花仙子☆ 提交于 2019-12-06 02:00:00
问题 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. 回答1: My solution that I've just tested and it works is add a message listener on the Android application and simply send from the wearable the details of what I want it to do. public class WearMessagesAPI_Service extends WearableListenerService {

Does AlarmManager require the PendingIntent to be of Type BroadcastReceiver?

一个人想着一个人 提交于 2019-12-06 01:24:28
The documentation for AlarmManager seems to imply (but does not outright explicitly require) that the PendingIntent you pass in to any of the set() methods should be of the type BroadcastReceiver , but I tested passing in other component types (like an IntentService ) and it seemed to work fine. Is it safe to use non- BroadcastReceiver Intents with AlarmManager ? Yes, and it has always worked, but I suspect not in the way that you're thinking. You can use any PendingIntent with an alarm; this could indeed be an activity or service PendingIntent. If it's a service PendingIntent, then the OS

Android - Why use pending intents for geofences

此生再无相见时 提交于 2019-12-05 23:27:48
问题 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 an activity, one would usually disconnect the location client in onPause() anyway, so previously added geofences would not be tracked either after the application paused/was destroyed, so why a pending intent? Or am I mistaken here? 回答1: I wonder

Android Geofencing - No coming intents?

我怕爱的太早我们不能终老 提交于 2019-12-05 23:01:20
问题 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. Never. With great, accurate GPS fix, standing in the middle of fence. Nothing. Nothing suspicious in logs. No errors, no warnings. No itents come, the service does not start. Have anyone ever seen such a thing? (It is weird because I can't see any

Notify users when they reach a location

蹲街弑〆低调 提交于 2019-12-05 19:46:56
In the application I'm working on, one of the features is to notify the user when they reach a location that they have set prior. The code below is in addProximityAlert in Activity: final Intent intent = new Intent(PROX_ALERT_INTENT); final PendingIntent pendingIntent = PendingIntent.getBroadcast( InfoActivity.this, 0, intent, PendingIntent.FLAG_ONE_SHOT); LocationManager locationManager = (LocationManager) this .getSystemService(Context.LOCATION_SERVICE); locationManager.addProximityAlert(18.7726271, 98.9738381, 5000, -1, pendingIntent); this.locationReminderReceiver = new

Widget onUpdate is not setting pendingIntent on button click after reboot

我是研究僧i 提交于 2019-12-05 19:45:26
I'm creating a test widget that shows random number by clicking its button. everything is inside onUpdate of my Provider independently, including the pendingIntent . it works fine but after rebooting the phone views.setOnClickPendingIntent is not working although RemoteViews is recreated with no issue but the button becomes unresponsive. public class TestWidget extends AppWidgetProvider { static HashMap<Integer, BroadcastReceiver> br = new HashMap<>(); static void updateAppWidget(Context context, final AppWidgetManager appWidgetManager, final int appWidgetId) { context = context