broadcastreceiver

Activity can't start from broadcast receiver

五迷三道 提交于 2020-01-24 00:37:07
问题 Start Activity from Broadcast receiver is not working on android 9 but its working below android 9 it's working fine, I searched a lot regarding this but could not find the suitable solution. Does anyone face the same problem, here is my code . public void onReceive(final Context context, Intent intent) { try { this.tm = (TelephonyManager) context.getSystemService("phone"); this.tm.listen(new PhoneStateListener() { public void onCallStateChanged(int state, final String num) { if (state == 1 &

Android Broadcast Receiver Not Working

牧云@^-^@ 提交于 2020-01-24 00:34:47
问题 I am trying to make my app print something to log when screen is turned on but it doesn't work as I expected. Here is what I have in my Manifest file <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity ...> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name="PhoneBroadcastReceiver" android:enabled="true"> <intent-filter> <action

Android: Get notification for “Mobile data” network type changes

眉间皱痕 提交于 2020-01-24 00:18:25
问题 Working on a Android network utility Know Your Android Network I know that we can easily handle the changes in network state by creating our own Broadcast Receiver and check whether n/w switched from WiFi to Mobile data, But is there a way to get notification when "Mobile Data" switches from one network type to the other. Basically I need to know when "mobile data" connection jumps from one network type to the other, Below can be the various network types: NETWORK_TYPE_1xRTT NETWORK_TYPE_CDMA

Android: Get notification for “Mobile data” network type changes

蓝咒 提交于 2020-01-24 00:18:14
问题 Working on a Android network utility Know Your Android Network I know that we can easily handle the changes in network state by creating our own Broadcast Receiver and check whether n/w switched from WiFi to Mobile data, But is there a way to get notification when "Mobile Data" switches from one network type to the other. Basically I need to know when "mobile data" connection jumps from one network type to the other, Below can be the various network types: NETWORK_TYPE_1xRTT NETWORK_TYPE_CDMA

Android broadcast receivers vs aidl

为君一笑 提交于 2020-01-23 05:20:43
问题 What are the pros and cons of using aidl vs broadcast receivers for sending messages between apps (for both background and foreground handling)? I've been using receivers which is nice due to the subscription model with intent filters, and the ease of use / extensibility. Are there drawbacks to using this approach to vs AIDL? Thx Ben 回答1: BroadcastReceiver It is an Asynchronous communication. Complexity is low - It is the easiest way to communicate between processes. One to All communication

Open activity by clicking on the push notification from Parse

此生再无相见时 提交于 2020-01-22 13:54:26
问题 I want to receive a push notification from Parse and open an List activity and use intent.putextra("dataFromParse") before starting the activity. I'm able to receive the push but only open the MainActivity by using this: PushService.setDefaultPushCallback(this, MainActivity.class); ParseInstallation.getCurrentInstallation().saveInBackground(); I want to have this as the default, but should also be able to start the List activity. I have also tried using a customer receiver, but then I'm only

Open activity by clicking on the push notification from Parse

柔情痞子 提交于 2020-01-22 13:52:07
问题 I want to receive a push notification from Parse and open an List activity and use intent.putextra("dataFromParse") before starting the activity. I'm able to receive the push but only open the MainActivity by using this: PushService.setDefaultPushCallback(this, MainActivity.class); ParseInstallation.getCurrentInstallation().saveInBackground(); I want to have this as the default, but should also be able to start the List activity. I have also tried using a customer receiver, but then I'm only

RTC_WAKEUP is not working

杀马特。学长 韩版系。学妹 提交于 2020-01-22 10:04:10
问题 Currently i am working on a Broadcast Receiver application, in which i am making an Alarm which should display a message after we enter the seconds. I used RTC_WAKEUP, which means it should display the message when the device is on and it is supposed to turn on the device and then display the message when the device is off. MY PROBLEM IS THAT IT RTC_WAKEUP DOESN'T ON MY DEVICE but it is working properly when device is on. i am pasting the code of my application. In my application there are

How to access Switch button that is declared in MainActivity(layout) in BroadcastReceivers

我的未来我决定 提交于 2020-01-22 03:40:10
问题 I have a task in which i have to change state of Switch button when airplane mode is ON/OFF. I have a main activity in which i declared Switch Button and i want to Change the state on/off of Switch from BroadcastReceiver Class Receiver public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { boolean isAirplaneModeOn = intent.getBooleanExtra("state", false); if(isAirplaneModeOn){ What Should i do ? } } } layout_main_activity <?xml

How to fix the Android error “Background execution not allowed: receiving Intent {…}”

笑着哭i 提交于 2020-01-22 02:52:05
问题 So I'm programming an Android app that uses Bluetooth discovery of devices. Here is the code I use to start discovery. try { myBluetoothAdapter.startDiscovery(); Log.d("Bluetooth Started successfully","yes"); } catch (Error e) { Log.d("FAILED","Ya failed mate"); e.printStackTrace(); } I then register a BroadcastReceiver to watch for when devices are found. Here is my code for that IntentFilter intentFilter = new IntentFilter(BluetoothDevice.ACTION_FOUND); final ArrayList<String>