broadcastreceiver

Android: How to Resume Application/Activity from BroadcastReceiver?

半腔热情 提交于 2020-01-14 13:04:32
问题 If my procedure is following: Launch Activity A -> Activity B Press 'Home' button. Click on the application again. Result: 'Activity B' shows up (it resumes ). Launch Activity A -> Activity B Press 'Back' button. Click on the application again. Result: 'Activity A' shows up (it restarts ). I want to do exactly same from the BroadcastReceiver. Launch Activity A -> Activity B Press 'Home' button. BroadcastReceiver receives a broadcast and want to "resume" application. My expected result:

Android: How to Resume Application/Activity from BroadcastReceiver?

浪尽此生 提交于 2020-01-14 13:04:18
问题 If my procedure is following: Launch Activity A -> Activity B Press 'Home' button. Click on the application again. Result: 'Activity B' shows up (it resumes ). Launch Activity A -> Activity B Press 'Back' button. Click on the application again. Result: 'Activity A' shows up (it restarts ). I want to do exactly same from the BroadcastReceiver. Launch Activity A -> Activity B Press 'Home' button. BroadcastReceiver receives a broadcast and want to "resume" application. My expected result:

Android: How to Resume Application/Activity from BroadcastReceiver?

六月ゝ 毕业季﹏ 提交于 2020-01-14 13:04:01
问题 If my procedure is following: Launch Activity A -> Activity B Press 'Home' button. Click on the application again. Result: 'Activity B' shows up (it resumes ). Launch Activity A -> Activity B Press 'Back' button. Click on the application again. Result: 'Activity A' shows up (it restarts ). I want to do exactly same from the BroadcastReceiver. Launch Activity A -> Activity B Press 'Home' button. BroadcastReceiver receives a broadcast and want to "resume" application. My expected result:

Force stop will make app's receiver not being called?

丶灬走出姿态 提交于 2020-01-14 12:19:48
问题 I have a service declared in XML that responds to PACKAGE_ADDED broadcast intent. It works fine, but I just found out that if I force stop the app, the receiver won't receive anything anymore. It's not being called. Is this normal? What can I do? I need to make sure it always responds. 回答1: Since version 3.1 of Android an application cant receive broadcast intents until its stared once manually. Before the first start, the application is considered as "Stopped" by the launcher. (http:/

Alarm in the AlarmManager get erased when process is killed

[亡魂溺海] 提交于 2020-01-14 09:00:35
问题 I'm a newbie in android so please bear with me. My Main activity creates and alarm in the alarm manager which supposed to fire in specific time, my main Activity also create Broadcast receiver which suppose to receive the Intent that the alarm fired, everything is working good until Task manager killing my App. I've check the PendingIntent list in the AlarmManager and verify that my alarm is getting erased from the Alarm Manager, I try to add service and register alarm from the service, I've

how to use context inside the Broadcast Receiver?

孤街浪徒 提交于 2020-01-14 05:50:07
问题 I managed to create a function that returns context of an activity and I used this context inside a broadcast receiver and it does what it supposed to do, if the application is not stopped, but when I stop the application I cant get the context of the activity because it returns null value, so how can I maintain the context value to be used by the broadcast receiver even if my application gets killed ? This is the function that returns the Context object and the constructor is called inside

How to send an array from broadcastReceiver class to MainActivity

女生的网名这么多〃 提交于 2020-01-14 04:44:08
问题 I am working in an Android application that looks for pharmacies that have a specific medicine .all that throw SMS . so the app receive a SMS that contains the name of all pharmacies that have the medicine,saved them in an array named OurString but this array is in broadcast receiver class .i have trid to send a string and it worked but when i tried the array didnt worked.so how do I send array to other class to view the pharmacies's names in a listView. This is my BroadcastRecieve class:

SMS_RECEIVED onReceive android 2.3.5 not triggering

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-14 04:41:10
问题 I've been puzzling over this one recently, prior to 2.3.5 this seems to work fine (on my colleagues devices). However on mine it now never triggers. I've stripped the code right back and made a very simple test application to see what's going on. Basically the onReceive code doesn't ever appear to trigger, even though adb/logcat does seem to show the register of the BroadcastReveiver does take place. Here's the simple code I've gone for: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns

Wifi Broadcastreceiver onreceive

孤街浪徒 提交于 2020-01-14 04:10:10
问题 I have problems with the wifi broadcast receiver. It doesn't receive anything, onReceive is never called. Here's my code: public final class WifiChangeReceiver extends BroadcastReceiver { boolean portableHotspot = true; @Override public void onReceive(final Context context, Intent intent) { boolean alreadyPresent = false; String action = intent.getAction(); if(action.equals(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION)) { WifiManager w = (WifiManager) context .getSystemService(Context.WIFI

How to refresh a ListView from a BroadcastReceiver?

孤街醉人 提交于 2020-01-13 12:53:48
问题 If I call notifyDataSetChanged() on the custom adapter associated to my ListView, all the views should refresh themself ( getView() will be called). Now I have a BroadcastReceiver that is listening to an event. When the event fires, the ListView must be refreshed. How can I achieve this? Thanks! 回答1: If you refresh listview from receiver you'll have code like this: BroadcastReceiver br; public final static String BROADCAST_ACTION = "BROADCAST_ACTION"; br = new BroadcastReceiver() { public