android-pendingintent

Pending Intents for sending SMS not working well while sending many messages

隐身守侯 提交于 2019-12-05 13:05:44
I am Developing an App , In which I send SMS and I need to find if It's delivered or not. Every thing seems to be well if I send A message to a person. But In some situations I got wrong Information , for example , First I send A message to number 0000 (But It will not deliver) and after it I send a message to number 0001 and It delivers (message to 0000 is still not delivered) but I got a toast with : sms delivered to 0000(But only message to 0001 is delivered) , What Should I do to fix this conflict in Delivery reports ? Here is my code: try { SmsManager smsManager = SmsManager.getDefault();

singleTask and singleInstance not respected when using PendingIntent?

烈酒焚心 提交于 2019-12-05 12:39:45
I have an activity with launchMode set to singleTask: <activity android:name="com.blah.blah.MyActivity" android:launchMode="singleTask"> </activity> I have an ongoing notification with a PendingIntent that launches that activity: Intent activityIntent = new Intent( this, MyActivity.class ); TaskStackBuilder stackBuilder = TaskStackBuilder.create( this ); stackBuilder.addParentStack( MyActivity.class ); stackBuilder.addNextIntent( activityIntent ); PendingIntent resultingActivityPendingIntent = stackBuilder.getPendingIntent( REQUEST_CODE, PendingIntent.FLAG_UPDATE_CURRENT ); ... m

Two buttons with PendingIntents - Widget

萝らか妹 提交于 2019-12-05 11:43:29
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"); intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId); Intent intentSettings = new Intent();

'startactivity called from non-activity context service' warning when launching intent from notification

妖精的绣舞 提交于 2019-12-05 10:52:05
I've a service which starts a notification with startForeground() , I want the notification to launch an activity on click. The acitivty I want to launch defined as android:launchMode="singleTask" and usually runs before the service starts. Here is my pending intent creation code : Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); When I click on the notification I get the following warning : startActivity called from non

AlarmManager object after turning off and on the phone

ぃ、小莉子 提交于 2019-12-05 08:57:49
In my app, I set an alarm AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); ... PendingIntent pendingIntent = PendingIntent.getBroadcast(context, id, intent, PendingIntent.FLAG_UPDATE_CURRENT); ... alarmMgr.set(AlarmManager.RTC_WAKEUP, time.getTimeInMillis(), pendingIntent); It works fine unless I turn off and turn on the phone. To be more specific, let's say at 10:20, I set an alarm to 10:22 and I turn off and turn on the phone at 10:21, alarm won't work. What might be the problem? Is that a broadcast issue of the pendingIntent there or should I set some

PendingIntent to launch and stop a Service

旧时模样 提交于 2019-12-05 01:34:52
I'm trying to make a simple widget with a button that start a Service with the OnClickPendingIntent() . I can start it fine but I can't figure out a way to stop it (I know I can do it with a BroadcastReceiver or something similar but I would like to avoid hardcode). This is my code: Intent intent = new Intent(context, myService.class); PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0); RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.my_widget); if (!ismyserviceup(context)) { views.setOnClickPendingIntent(R.id.my_button, pendingIntent); } else

Didn't include a pendingIntent in the extras?

喜欢而已 提交于 2019-12-05 00:18:18
I came across this Error message on Logcat while working on an app. Can anyone tell me what it means? 07-24 23:34:20.288 1140-1140/? E/NetworkScheduler.SchedulerReceiver﹕ Invalid parameter app 07-24 23:34:20.288 1140-1140/? E/NetworkScheduler.SchedulerReceiver﹕ Invalid package name : Perhaps you didn't include a PendingIntent in the extras For your information: I used an AlarmManager in this app It is probably means that you are missing a uses-library deceleration inside the AndroidManifest.xml file. If you can provide 1 line of the log just before getting this error message it will be helpful

Android notification callback

若如初见. 提交于 2019-12-04 19:19:20
I'm using this tutorial on AsyncTask with a task and a notification: https://eliasbland.wordpress.com/2011/03/11/an-example-of-how-to-run-a-background-task-and-report-progress-in-the-status-bar-using-asynctask-on-android/ What I'm confused about is how to make a callback do something in the original class it was called from. Optimally, it would be great to have something like: private class DownloaderTask extends AsyncTask { doInBackground() { ... download the file ... } onProgressUpdate, onPreExecute, etc. from the example, managing a notification. notificationClicked() { if (success) { /

How to launch a new activity using pending intent

半世苍凉 提交于 2019-12-04 16:56:51
问题 Can anyone please say how to launch a new activity using pending intent and also to pass a value using pending intent. Thanks in advance. 回答1: Intent intent = new Intent(getApplicationContext(), ActivityToLaunch.class); intent.putExtra(<oneOfThePutExtraFunctions>); PendingIntent pi = PendingIntent.getActivity(this, 0, intent, 0); You can add extra data into an Intent by using one of the various Intent.PutExtra() functions located: http://developer.android.com/reference/android/content/Intent

Android: Adding data to Intent fails to load Activity

混江龙づ霸主 提交于 2019-12-04 12:55:28
问题 I have a widget that supposed to call an Activity of the main app when the user clicks on widget body. My setup works for a single widget instance but for a second instance of the same widget the PendingIntent gets reused and as result the vital information that I'm sending as extra gets overwritten for the 1st instance. So I figured that I should pass widget ID as Intent data however as soon as I add Intent#setData I would see in the log that 2 separate Intents are appropriately fired but