android-broadcast

WakefulBroadcastReceiver onReceive not triggering android GCM

十年热恋 提交于 2019-12-20 06:07:10
问题 I implemented GCM notifications in Android and everything was working fine. I'm sending Notifications to the phone via a PHP server using the Google Cloud Messaging Service. After a week or so I installed that app again on my phone and send a test notification onto my phone but I got nothing. The PHP script runs without any error with success=1 and no cononical id's in the GCM response. WakufulBroadcastReceiver isn't triggered in the android app. Here is the complete code that I am using:

WakefulBroadcastReceiver onReceive not triggering android GCM

为君一笑 提交于 2019-12-20 06:06:51
问题 I implemented GCM notifications in Android and everything was working fine. I'm sending Notifications to the phone via a PHP server using the Google Cloud Messaging Service. After a week or so I installed that app again on my phone and send a test notification onto my phone but I got nothing. The PHP script runs without any error with success=1 and no cononical id's in the GCM response. WakufulBroadcastReceiver isn't triggered in the android app. Here is the complete code that I am using:

How can send sms in android in dual SIM with set default sim?

谁都会走 提交于 2019-12-19 04:21:21
问题 How can send sms in android with dual sim for broadcast not intent?? How can detect dual sim in android? User wants to select sim for send sms broadcast. In android set the default sim for sending msg in dual sim in android. User have to select particular sim for sending sms. 回答1: If the output of the shell command ' service list ' contains ' telephony.registry2 ', then the phone has a second SIM card. If contains ' telephony.registry3 ', then phone has a third SIM card and so on. You can use

How to prevent SMS going to inbox in Android Kitkat

谁都会走 提交于 2019-12-19 04:15:27
问题 In previous versions of android we could block SMS by using following code: <receiver android:name=".broadcastreceivers.OnSMSReceived" android:exported="true" android:permission="android.permission.BROADCAST_SMS"> <intent-filter android:priority="1000"> <action android:name="android.provider.Telephony.SMS_RECEIVED"/> </intent-filter> </receiver> and in broadcast receiver, abortBroadcast() function prevent SMS from going to inbox. But this method is not working in kitkat as, from Kitkat SMS

How to detected if application is closed

[亡魂溺海] 提交于 2019-12-18 05:16:10
问题 I have an app that receives from the Broadcastreceiver to fetch new data from the web(json), when my app is running while it fetches; everything runs well, when the app is closed it crashes "Your app stopped working". Even the following good to check if my app is in the foreground doesn't work. i want it so if the app is closed, not running, to call an intent to open the app for it not to crash, so how do I check if application is closed? My code; public class UpdateReceiver extends

how to check screen on/off status in onStop()?

守給你的承諾、 提交于 2019-12-17 22:32:50
问题 as mentioned here, when the screen goes off, the onStop() of current Activity will be called. I need to check the screen on/off status when the onStop() of my Activity is called. so I have registered a BroadcastReceiver for these actions( ACTION_SCREEN_ON AND ACTION_SCREEN_OFF ) to record the current on/off status(and they work properly, I have logged!). but when I turn off the screen and check the on/off status in the onStop , it says the screen is on. why? I think the receiver must receive

how to start my application when ever mobile restart or turn on

六眼飞鱼酱① 提交于 2019-12-17 21:22:47
问题 How do i set my application as startup application, so when ever mobile restarts or turned ON, my application starts. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.installedapps22" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> <application android:icon="@drawable/cherry_icon" android:label="@string/app_name"> <activity android:name="

Listen to incoming Whatsapp messages/notifications

ぃ、小莉子 提交于 2019-12-17 17:33:33
问题 I'm working on a notification based app, for which I need to listen to incoming notifications. I've been able to listen to incoming calls, SMS, mail etc. I have no clue how to listen for pings or messages from friends on Whatsapp via code. Can this actually be done? If so, how? Can Accessibility Service be used for this, using Package Name as "com.whatsapp"? 回答1: I was able to do this using Accessibility Service . Using this, you can listen to all notification on the notification bar. I

Android - Trying to test a service on boot (java.lang.SecurityException: Permission Denial)

风格不统一 提交于 2019-12-17 16:27:27
问题 I've been trying to test a service when a device boots up on android, but I cannot get it to work. I'm trying to start it with this command from CMD: (in ..\AppData\Local\Android\sdk\platform-tools) adb shell am broadcast -a android.intent.action.BOOT_COMPLETED or adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android/.MyReceiver AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http:/

Android ACTION_DATE_CHANGED broadcast

ε祈祈猫儿з 提交于 2019-12-17 10:58:06
问题 I have a Nexus S, and when I change the date manually on the phone, ACTION_DATE_CHANGED is not always broadcasted. If I change the date from Feb 13, 2014 to Feb 14, 2014, I have not gotten an ACTION_DATE_CHANGED to work, but if I set it to several years in the future, I sometimes get it to fire. I can (99%) assure you I'm not misusing IntentFilters, BroadcastReceivers, etc. I'm just curious as to why this broadcast is so poorly documented. A quick scan through SO & Google shows that people