android-pendingintent

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

一个人想着一个人 提交于 2019-12-10 03:47:00
问题 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 android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application at android.view.ViewRootImpl.setView(ViewRootImpl.java:594) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) at

How can I send an SMS from a BroadcastReceiver and check its status?

拥有回忆 提交于 2019-12-09 18:21:39
问题 So this is my BroadcastReceiver public class IncomingSMSListener extends BroadcastReceiver { private static final String SMS_EXTRA_NAME = "pdus"; @Override public void onReceive(Context context, Intent intent) { SmsMessage[] messages = fetchSMSMessagesFromIntent(intent); } private SmsMessage[] fetchSMSMessagesFromIntent(Intent intent) { ArrayList<SmsMessage> receivedMessages = new ArrayList<SmsMessage>(); Object[] messages = (Object[]) intent.getExtras().get(SMS_EXTRA_NAME); for (Object

Notification with “null” PendingIntent

折月煮酒 提交于 2019-12-09 04:18:26
问题 I'm trying to implement notification in Android. Now I have a problem, I don't want to have a PendingIntent that user will open any Activity . How can I do that? 回答1: PendingIntent contentIntent = PendingIntent.getActivity( getApplicationContext(), 0, new Intent(), // add this PendingIntent.FLAG_UPDATE_CURRENT); 回答2: The following works and seems more straightforward: PendingIntent pi = PendingIntent.getActivity(context, 0, null, 0); Having a notification without launching a subsequent

Multiple notification from GCM not directing to correct activity

眉间皱痕 提交于 2019-12-09 02:04:37
问题 I am using GCM for push notifications. My constraint is that from the received bundle from GCM server I have to redirect user to specific location in my application. Every thing is working fine when I have only one notification. If there are two notification in the notification tray then the user is redirected to the activity based on the latest bundle. All other bundle are ignored. I have followed many SO post like this and this but it didnot solve my problem. Here are excerpts from my code:

How to open pdf from a notification

邮差的信 提交于 2019-12-08 13:04:26
问题 I want to open pdf when i press on the notification i tried to to this: public void addNotification(String path) { createNotificationChannel(); File file = new File(path); // set your audio path Intent intent = new Intent(); intent.setData(Uri.fromFile(file)); intent.setAction(android.content.Intent.ACTION_VIEW); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0); //Intent landingIntent = new Intent(this, MainActivity.class); // landingIntent.setFlags(Intent.FLAG_ACTIVITY

IntentService, PendingIntent, and AlarmManager: Cannot keep process running indefinitely?

我的未来我决定 提交于 2019-12-08 12:08:22
问题 I've got a pretty simple app that runs two services in the background, using IntentService with AlarmManager. One is a "messaging" service that sends a JSON request and parses the response, the other polls for location from a LocationManager. The requirement here is that they run on an interval, indefinitely, until manually stopped by the user, with a button - even if the device's screen hasn't been turned on for days. The services must never stop. Battery life is not a concern. My minimum

How to launch Amazon Shopping app in Android app?

て烟熏妆下的殇ゞ 提交于 2019-12-08 10:49:12
问题 I'd like to be able to launch the Amazon Shopping app from my android application. How is this possible? What parameters would need to go into the Intent? Here is a link to the Amazon Shopping app: https://play.google.com/store/apps/details?id=com.amazon.mShop.android.shopping&hl=en In addition, how would it be possible to pass a deep-link parameter so that it lands on a specific product page? Thank you! 回答1: I'd like to be able to launch the Amazon Shopping app from my android application.

FLAG_ACTIVITY_NEW_TASK not behaving as expected when used in PendingIntent

杀马特。学长 韩版系。学妹 提交于 2019-12-08 08:36:52
问题 Ok, bear with me here My App is composed of a splash screen activity (A) and the main activity (B). When the app starts, (A) is displayed for a bit and then it starts (B). Afterwards (A) is finished. This works fine under "normal" conditions. Here is the code to launch (B) final Handler handler = new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { Intent mainIntent = new Intent(A.this, B.class); startActivity(mainIntent); finish(); } }, SPLASH_DELAY); When a

How to connect an android widget to my android application? both are my Android applications

∥☆過路亽.° 提交于 2019-12-08 07:16:28
I want to combine my widget and one of my android application.. Is it possible to do that? My plan is, once user open up my android widget, the widget will directly open up my android application? Is there any way how? I made some method here from my widget class: public class ExampleAppWidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int i = 0; i < appWidgetIds.length; i++) { int appWidgetId = appWidgetIds[i]; Intent intent = startActivity(new Intent("com.xxx.yyy.widget.FlamingoActivity"));

Android GCM multiple push notifications with one icon in status bar

女生的网名这么多〃 提交于 2019-12-08 05:28:56
问题 My app wants to bundle multiple push notifications in one icon in the status bar. When clicking on the icon, the multiple notifications should be received by the app to show them in listview mode. There are already some entries in stackoverflow which come close to what I want to obtain and it did give me a better insight in handling pending intents and notification flags but they didn´t solve completely my problem. First step: Creating the notification: Following some entries in stackoverflow