broadcastreceiver

call AsyncTask from Broadcast receiver android

你离开我真会死。 提交于 2020-02-26 08:27:56
问题 SO currently i have an AsyncTask class that runs and POST's data to my server when I click a button(which works great). What im trying to do now is handle what happens when the user is not connected to the internet. so i have set up these classes to notify the app when internet has connected so that the data can be sent automatically to the server. AsyncTask class(inner class) private class HttpAsyncTask extends AsyncTask<String, Void, String> { ProgressDialog dialog = new ProgressDialog

Equivalent android.content.BroadcastReceiver in Swift

瘦欲@ 提交于 2020-02-21 10:14:55
问题 I would like to know if there is an equivalent android.content.BroadcastReceiver in Swift. I would need the same handler like onReceive(Context context, Intent intent) It is possible ? Thank you Ysee 回答1: In Swift in order to achieve the same effect you would use the NSNotificationCenter . Take a look at this link below for some guidance http://www.andrewcbancroft.com/2014/10/08/fundamentals-of-nsnotificationcenter-in-swift/ 来源: https://stackoverflow.com/questions/30397163/equivalent-android

Equivalent android.content.BroadcastReceiver in Swift

偶尔善良 提交于 2020-02-21 10:12:51
问题 I would like to know if there is an equivalent android.content.BroadcastReceiver in Swift. I would need the same handler like onReceive(Context context, Intent intent) It is possible ? Thank you Ysee 回答1: In Swift in order to achieve the same effect you would use the NSNotificationCenter . Take a look at this link below for some guidance http://www.andrewcbancroft.com/2014/10/08/fundamentals-of-nsnotificationcenter-in-swift/ 来源: https://stackoverflow.com/questions/30397163/equivalent-android

Broadcast Receiver not working for voice network

两盒软妹~` 提交于 2020-02-08 05:18:24
问题 I want to receive notification when Mobile network connection is lost or received. Through following code, I can receive notification for Wi-Fi (Data) connection but not for Mobile (Voice) connection. Manifest : <uses-permission android:name="android.permission.ACCESS_NETWORK_ST ATE"/> <application android:icon="@drawable/icon" android:label="@string/app_name"> <receiver android:name=".notifier"> <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE " /> </intent-filter>

Broadcast receiver not working when app is closed

拜拜、爱过 提交于 2020-02-08 02:30:30
问题 So I have two different apps made, one sends a broadcast and another receives it and displays a toast. However, when I close the receiver app the broadcast is no longer received by the second app even though I defined the receiver in the manifest file. The broadcast sender in the MainActivity of app1. public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

Broadcast receiver not working when app is closed

孤街醉人 提交于 2020-02-08 02:30:29
问题 So I have two different apps made, one sends a broadcast and another receives it and displays a toast. However, when I close the receiver app the broadcast is no longer received by the second app even though I defined the receiver in the manifest file. The broadcast sender in the MainActivity of app1. public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);

SMS Broadcast Receiver in Oreo+

巧了我就是萌 提交于 2020-02-07 03:59:32
问题 I am trying to intercept SMS messages delivered to my device. I wrote an app to do that a year or so ago, and I find it is no longer catching messages (even though code is unchanged). I don't believe it is permission-related. I tried compiling under SDK 23 (requiring runtime permissions) and SDK 22 (no runtime permissions). (In the case of 23, I verified that permission RECEIVE_SMS is successfully granted). Most questions/answers about this issue are quite old. IMHO The answers didn't seem

SMS Broadcast Receiver in Oreo+

陌路散爱 提交于 2020-02-07 03:59:05
问题 I am trying to intercept SMS messages delivered to my device. I wrote an app to do that a year or so ago, and I find it is no longer catching messages (even though code is unchanged). I don't believe it is permission-related. I tried compiling under SDK 23 (requiring runtime permissions) and SDK 22 (no runtime permissions). (In the case of 23, I verified that permission RECEIVE_SMS is successfully granted). Most questions/answers about this issue are quite old. IMHO The answers didn't seem

Incorrect timestamp on future notifications

☆樱花仙子☆ 提交于 2020-02-03 05:26:10
问题 When my application is launched, it performs an API call and then schedules notifications based on the results. This amounts to around ~10 notifications being scheduled. There seems to be an issue with the timestamp displayed on the actual notification being incorrect. Since I am creating these notifications and then scheduling an alarm with an AlarmManager , the default time present on the notification will be the time at which the notification is created ( System.currentTimeMillis() ). I've

Any way to receive a broadcast before the network goes down

冷暖自知 提交于 2020-02-02 19:59:12
问题 I already have a few receivers running, including one for reboot and entering flight mode. However I'm not always getting the Intent in time for me to do what I need to do, send a quick message to an external server. Even setting the intent filter to priority 1000 doesn't guarantee that I get to transmit before it is too late, though it does help. As stated, it is not that I do not receive my broadcasts, I just get them too late, after the network is already down. Any pointers to where I may