broadcastreceiver

AsyncTask in BroadcastReceiver in Android gives sending message to a Handler on a dead thread error

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 03:02:31
问题 I have implemented Push Notification in my appliction. Once the push message is received I call a webservice with the help of AsyncTask. This works fine when the application is being used or is in the memory. But if I stop the application from settings and then if the message is pushed to the device, there is an exception such as "sending message to a Handler on a dead thread". This is probably since the app is not live. Can someone let me know if its alright to actually remove AsyncTask from

Can we call an external method between before and around advices? (For the same pointcut)

依然范特西╮ 提交于 2019-12-23 02:57:26
问题 I have a general AOP question, please clarify me on this situation, let's assume we have an execution pointcut that catches a method execution : In our aspect we have a : pointcut pointcut_CatchMethod(Activity activity) : execution(String methodA(..)) && target(activity); Here, we have a methodA() in target activity. and we have 2 advices before and around. Like : before(Activity activity) : pointcut_CatchMethod(activity){ //Do something... } String around(Activity activity) : pointcut

What does the “id” field in an Android “Google Play Music” broadcast intent correspond to?

天大地大妈咪最大 提交于 2019-12-23 02:41:39
问题 I've got an android app that listens to music broadcasts. It receives track change notifications using the following ApplicationManifest.xml (snippet): <receiver android:name=".music.AndroidMusicBroadcastReceiver"> <intent-filter> <action android:name="com.android.music.metachanged"/> <action android:name="com.android.music.playbackcomplete"/> <action android:name="com.android.music.playstatechanged"/> <action android:name="com.htc.music.metachanged"/> <action android:name="com.htc.music

How to know when bluetooth disconnected

£可爱£侵袭症+ 提交于 2019-12-23 02:40:11
问题 i am trying to "catch" when the bluetooth is disconnected from a device. im am using this code: if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)){ deleteNotification(); setWarningState(WarningState.RedWarning); showNotification("You are parked"); but when im disconnection the bluetooth by turning off the remote device or by turning off the bluetooth toggle in the phone it will not enter this if statment. when im using this: BluetoothDevice.ACTION_ACL_CONNECTED.equals(action) its

Multiple Alarms Restart After Boot

≡放荡痞女 提交于 2019-12-23 02:35:09
问题 I'm setting multiple alarms so they can be repeated on specific days. Now I have heard that Android doesn't save the alarms on reboot. I have also read that BroadcastReceiver should be used when BOOT_COMPLETED to reschedule all the alarms. But how do I tell the BroadcastReceiver to reschedule alarms after reboot if I have 5 alarms per day = around 35 alarms scheduled on different days. Do I need to store them in the database or? How do I store them? Or is the BOOT_COMPLETED all I need? Is

Block SMS in android

≯℡__Kan透↙ 提交于 2019-12-23 01:04:49
问题 i developing an application where i want to block SMS of some specific numbers.For testing i do SMS from that number that i have in IF CONDITION but this code is not blocking that number SMS. i try best but did't resolved. any one help me.Here is my code Sms.java public class Sms extends BroadcastReceiver { final SmsManager sms = SmsManager.getDefault(); @Override public void onReceive(Context context, Intent intent) { // Retrieves a map of extended data from the intent. final Bundle bundle =

Broadcast receiver for gtalk/gmail message receive

此生再无相见时 提交于 2019-12-22 18:38:17
问题 It is easy to find on google which is the broadcast receiver to listen for sms messages. Is there also a similar receiver to listen for gtalk messages or new emails? Thanks 回答1: Neither of those applications are part of the SDK, so there are no documented broadcast Intents for either action -- sorry! 来源: https://stackoverflow.com/questions/2412393/broadcast-receiver-for-gtalk-gmail-message-receive

Listen Android incoming SMS when Google Hangout or other app receives it

核能气质少年 提交于 2019-12-22 18:31:18
问题 I am trying to use a broadcast receiver to read incoming SMS in my app and also able to do so. However, if someone receives SMS on google hangout instead of default SMS app, the broadcast receiver doesn't work. The following is the code I am using: public class SmsListener extends BroadcastReceiver { // Get the object of SmsManager final SmsManager sms = SmsManager.getDefault(); public void onReceive(Context context, Intent intent) { // Retrieves a map of extended data from the intent. final

broadcastreceiver onReceive problem ACTION_MEDIA_BUTTON Android

大兔子大兔子 提交于 2019-12-22 17:38:28
问题 I've found a lot of pages about this in the web, but none of them helped me. I've been for hours stucked in this problem. That's why i decided to make my own question. What I want to do is an application that receives an intent of the type ACTION_MEDIA_BUTTON and the method onReceive() of the Broadcastreceiver does something. My Activity is like this: public class MusicControlActivity extends Activity { private MediaButtonIntentReceiver receiver = new MediaButtonIntentReceiver(); @Override

Broadcast receiver not affecting shared preferences in Android 4.0 (probably 3.1+)

。_饼干妹妹 提交于 2019-12-22 17:36:13
问题 So I have indeed searched thoroughly for an answer to my question; normally I can find answers pretty easily to pretty much anything. Anyway, basically I have an alarm manager set up which eventually sets a broadcast receiver. Inside the receiver, it decides which intent has been received, removes a shared preference, and then sets a notification that starts the activity. The problem is that on my phones with 4.0 the shared preference item is not successfully deleted, but on any previous