broadcastreceiver

Android: AlarmIntent gets killed when App is force closed on API 23 Lenovo Device - any workaround?

非 Y 不嫁゛ 提交于 2019-12-01 23:20:07
问题 i have a few AlarmIntents that are registered in the Manifest and therefore can run, even if the App itself not running. Everything is working fine on my API 26 Emulator, no matter if i clear the TaskManager or not. On my 23 real device, the Broadcasts are not working, if the App was force closed via Task Manager. Is there any workaround for this, or is that just something i have to accept? 来源: https://stackoverflow.com/questions/46011757/android-alarmintent-gets-killed-when-app-is-force

Updating an Activity from a BroadcastReceiver

╄→尐↘猪︶ㄣ 提交于 2019-12-01 23:15:02
问题 This question brought up an interesting issue. The OP has an app that displays a map, and this map needs to be updated with location markers that are received via SMS messages. The individual steps are fairly straightforward: the SMS messages can be received by a BroadcastReceiver , the markers can be displayed by an ItemizedOverlay on top of a MapView . The tricky part is to have the receiving part communicate with the main part of the app. What happens if the app has an active MapActivity ,

How to pass data from BroadcastReceiver to Activity without in onCreate()

我与影子孤独终老i 提交于 2019-12-01 23:12:33
问题 I have a serious issue about passing data from BroadcastReceiver to an Activity . Let see my issue carefully. I have a class PhoneStateReceiver extends BroadcastReceiver that used to received an incoming phone. public class PhoneStateReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { System.out.println("Receiver start"); String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); String incomingNumber = intent.getStringExtra

How to make my ios app reactive to wifi change events

三世轮回 提交于 2019-12-01 22:41:13
Can an ios app (possibly not active) be notified if there is a change in wifi network connected to(getting disconnected from, or getting connected to new ntwk)? I am to build an app that (even in inactive state) should get notified when connected to a particular wifi network and do some stuff. In android i was able to achieve it using BroadcastReceiver is there any such facility in ios? Thanks, Praneeth. Rajan Maheshwari We have a class called Reachability in iOS for detecting any network flicker/disconnection/connection. Reachability class can be found here Usage Add Reachability.swift class

Updating an Activity from a BroadcastReceiver

非 Y 不嫁゛ 提交于 2019-12-01 21:43:32
This question brought up an interesting issue. The OP has an app that displays a map, and this map needs to be updated with location markers that are received via SMS messages. The individual steps are fairly straightforward: the SMS messages can be received by a BroadcastReceiver , the markers can be displayed by an ItemizedOverlay on top of a MapView . The tricky part is to have the receiving part communicate with the main part of the app. What happens if the app has an active MapActivity , and then its BroadcastReceiver is invoked as a response to an incoming SMS? Is the MapActivity

Receiver not registered

淺唱寂寞╮ 提交于 2019-12-01 20:50:21
I have a progamm with async task and a broadcast receiver to send a result code, so that Asynctask will know that app is working. But it crashes, sayin the receiver is unreggistred in main activity. I've registred one receiver in main activity, another receiver is in AsyncTask Activity. So here the code and log cat. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mFragmentManager = getFragmentManager(); addFriendsFragment(); // The feed is fresh if it was downloaded less than 2 minutes ago mIsFresh =

Android - get a reference to a BroadcastReceiver defined in Manifest

£可爱£侵袭症+ 提交于 2019-12-01 20:26:01
Is there any way how to get a reference for a BroadcastReceiver defined in Manifest.xml from code? In my case, we are using a BroadcastReceiver that needs to be included in the Manifest.xml. However it has functionality I would like to reuse from within our code. So instead of creating another similar BroadcastReceiver and instantiating it from the code I would like to obtain a reference to the existing one. Additional information: My goal is to subscribe to an event on my BroadcastReceiver from my activity - an event that I would like to reuse - instead of creating another instance of this

Detect outgoing calls, issue with a real device

谁都会走 提交于 2019-12-01 20:20:22
I have a strange problem. To detect outgoing calls I have registered a broadcast receiver for android.intent.action.PHONE_STATE . When the state becomes OFFHOOK, then a conversation is started. It seems working on emulator: the debugger in fact reaches some code while it doesn't work on real device (Acer Liquid). Is it possible? Which is a way to detect outgoing calls? Well, if it works on the emulator, I would expect it to work on the device. You might registering a PhoneStateListener with the TelephonyManager via listen() and see if it gets you better results. If you think of it, comment on

Passing String data between Android applications

青春壹個敷衍的年華 提交于 2019-12-01 20:17:59
What is the best way to pass simple data such as a String between applications? The String is some field that is known in the sender app and is needed by the receiver app. I looked into storing it in a MODE_WORLD_READABLE SharedPreferences, but I won't necessarily know the package name (this would exist in a library), the value can be set by various apps, so it'd be difficult to look up. I was thinking have both apps contain BroadcastReceivers. When the receiver app is opened, it sends a custom Intent for the sender app to receive to tell it that it's ready to receive. Upon seeing that Intent,

How do I update my RecyclerView button state on click after alert dialog confirmation in activity/fragment?

我只是一个虾纸丫 提交于 2019-12-01 20:14:54
问题 I have a pretty unique situation, where I have a button in a recyclerview, which upon click (initial state "register"), passes an intent to a broadcast receiver in fragment or activity where it throws an alert dialog , with 2 options, yes or no. If no is selected, nothing happens and the dialog dismisses, but if yes is clicked, it processes a function I defined in my presenter class (related to data) and is supposed to update my button ui state to "cancel". and same goes for the other way