android-pendingintent

How to get Intent from PendingIntent

[亡魂溺海] 提交于 2020-01-14 07:02:42
问题 Can I get the Intent from a PendingIntent ? Here is the scenario: I create an Intent (let's call it myIntent ) I put some Extra information with a String (call it myInfo ) I create a PendingIntent ( myPendingIntent ) using myIntent I set an alarm using the AlarmManager and myPendingIntent At a later stage I get hold of the PendingIntent using PendingIntent.getBroadcast At that point I want to read myInfo from myIntent which is in myPendingIntent Is this possible? By looking around Google, I

Two buttons with PendingIntents - Widget

元气小坏坏 提交于 2020-01-13 10:35:52
问题 I'm creating a widget with two buttons. One of them updates the content of the widget and the second one must launch an activity. I have two PendingIntent for each action, but I can't make them both work. If one works the other one doesn't. I've revised the code and can't understand what's wrong. Any help will be very appreciated. This is the code. RemoteViews controls = new RemoteViews(context.getPackageName(), R.layout.miwidget); Intent intent = new Intent("actony.com.ACTUALIZAR_WIDGET");

Alarm receive don't work

爱⌒轻易说出口 提交于 2020-01-11 13:15:10
问题 I'm making an alarm receiver, but the alarm is not triggered. This is my code : Start alarm in MainActivity : private void setupAlarm(){ Intent intent = new Intent(this, com.logdata.AlarmReceiver.class); PendingIntent pIntent = PendingIntent.getService(this, 0, intent, 0); AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); manager.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + 1, 1000, pIntent); Log.e("setupAlarm", "Setup alarm

Determine if Activity is called by a Notification

a 夏天 提交于 2020-01-11 08:32:47
问题 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 can i determine wheter a Activity is created the "normal" way during runtime or by clicking on the notification? (Depending on the notification clicked, i want to forward to another tab instead of showing the main Tab.) Intent intent = new Intent

How to pass custom Serializable object to BroadcastReceiver via PendingIntent

大城市里の小女人 提交于 2020-01-10 05:27:38
问题 I am trying to pass a custom Serialized object from my IntentService to a BroadcastReceiver using PendingIntent. Here is my custom object: Row.java public class Row implements Serializable { private String name; private String address; public Row(BluetoothDevice device) { this.name = device.getName(); this.address = device.getAddress(); } } Here is my IntentService MyIntentService.java public class MyIntentService extends IntentService { public MyIntentService() { super("MyIntentService"); }

Show Dialog using PendingIntent

ぐ巨炮叔叔 提交于 2020-01-10 02:01:17
问题 I am working on Calender Events reminder . There is no native Calender events reminder in Android so user install different calender apps. Now these apps can be different on reminding events like on reminder notifications can be shown. Now I want that I set an event programmatically in these event calender apps and on time reached not show any notification rather a pop up message will be shown with alarm like sound. At that I using a code from that site . Its working but it showing reminders

Android PendingIntent extras, not received by BroadcastReceiver

非 Y 不嫁゛ 提交于 2020-01-08 13:22:16
问题 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 { private static String SENT = "SMS_SENT"; private static String DELIVERED = "SMS_DELIVERED"; private static int MAX_SMS_MESSAGE_LENGTH = 160; private static Context mContext; private BroadcastReceiver sendBroadcastReceiver, deliveryBroadcastReceiver;

Android : Continuous Location update

ⅰ亾dé卋堺 提交于 2020-01-07 06:57:20
问题 I am a newbie to Android and working on my very first application. I am working on a application which takes continuous location update and show that on google map. It means no matter whether application is in foreground or in background. For the same I am using fusedlocation API's requestLocationUpdates. There are two version of the same viz: With LocationListener when app is in foreground With pendingIntent when app goes to background. So as per my understanding I have to use both as I need

Cannot Send data Through pendingIntent

白昼怎懂夜的黑 提交于 2020-01-06 21:29:15
问题 I was trying to set a notification using pendingIntent.But I cant recieve the data which I sent. these are the codes Class for displaying notification(Working properly I can get every data from intent) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //---get the notification ID for the notification; // passed in by the MainActivity--- int notifID = getIntent().getExtras().getInt("id"); String date = getIntent().getExtras().getString("date"); String

Android alarm manager with multiple pending intents

扶醉桌前 提交于 2020-01-06 05:35:13
问题 So I have such app where you can create multiple journals and I want to set reminders for each journal. For example in one of the journals I set reminder to repeat every week on Tuesdays and Fridays and then in another journal I want to set different reminder on same days how can I do so that reminders wouldn't cancel each other? Because I cannot set one Alarm manager to repeat on different days I'm setting multiple alarm managers for each selected day with different requestCodes, but then if