broadcastreceiver

Broadcast Receiver does not trigger when Mobile Screen Locks

瘦欲@ 提交于 2019-12-05 14:26:24
When I install the app everything works fine. I am able to print Message body every time I send a message until I lock mobile screen. After that, the app stops printing incoming messages. I tried many ways to overcome this problem but with no luck. Please help me... public class SmsReceiveActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sms); receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(SMS_RECEIVED))

How to use NFC ACTIONS

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-05 13:46:08
I am trying to register a receiver programmatically to get notified once an NFC tag is detected. As shown in my code I registered for the desired action and I created the broadcast receiver programmatically. I also added the required permission in the manifest file but the problem is that onReceive is never called. Please let me know what I am doing wrong and how to fix it. IntentFilter intentFilter1 = new IntentFilter(); intentFilter1.addAction("android.nfc.action.TAG_DISCOVERED"); registerReceiver(mBCR_TAG_DISCOVERED, intentFilter1); private BroadcastReceiver mBCR_TAG_DISCOVERED = new

Permission Denial , even after adding the correct permission in the manifest

有些话、适合烂在心里 提交于 2019-12-05 13:37:38
I am developing an app which listens to incoming sms. I have added the permission: <uses-permission android:name="android.permission.RECEIVE_SMS" /> to my app manifest. And yes, it is not inside the receiver tag. I am trying to test the app by sending a sms from one emulator to another. My logcat gets the following entry : WARN/ActivityManager(66): Permission Denial: receiving Intent { act=android.provider.Telephony.SMS_RECEIVED (has extras) } to com.android.LUC requires android.permission.RECEIVE_SMS due to sender com.android.phone (uid 1001) The weird part is that when I am testing the app

Android - How to trigger a Broadcast Receiver to call its onReceive() method?

╄→гoц情女王★ 提交于 2019-12-05 13:32:52
问题 I have scheduled alarm for my application. I have implemented broadcast receiver to be triggered once the alarm time reaches. How to manually call broadcast receiver to execute the code inside of onReceive method without replicating the code twice. I thought of having the code in utility singleton call and call that method by having util class instance from anywhere. But is that any other way to call that onReceive method directly or else broadcast intent problematically. android:exported=

Start Service at boot without activity

元气小坏坏 提交于 2019-12-05 13:16:17
I want create an application which contains only a service (no activity). This service must start on boot. My problem is that it seems the boot receiver don't seems call if there aren't activity. I have test with the following example. I have the different files : MyReceiver.java : package com.test.teststartserviceatboot; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; import android.widget.Toast; public class MyReceiver extends BroadcastReceiver { @Override public void onReceive( Context ctx, Intent i ) { Log.v(

Not Receiving Parse Push Notifications on Android in Custom BroadcastReceiver

有些话、适合烂在心里 提交于 2019-12-05 12:11:27
I can successfully send a push notification using Parse with the following data, but can't receive the message in my custom Broadcast Receiver. Following the Parse Android notification guide: https://parse.com/docs/push_guide#receiving/Android . Any help would be appreciated! Sending the push: ParseQuery<ParseInstallation> userQuery = ParseInstallation.getQuery(); userQuery.whereContainedIn("user", arg0); JSONObject data= null; try { data = new JSONObject("{\"title\" : \"Hush!\"," + "\"intent\" : \"ChatWindowActivity\"," + "\"action\" : \"com.hush.UPDATE_STATUS\"," + "\"chatId\" :" +

ContentObserver vs. BroadCastReceiver : Battery Usage, Ram, CPU?

a 夏天 提交于 2019-12-05 11:57:48
Since there is such a needed concern for an application's battery usage, ram and cpu usage, what is the expense of multiple contentobservers vs. multiple broadcastreceivers? Example 1: A service running with START_STICKY using 5 contentobservers registered/unregistered properly. Example 2: A service being fired from 5 broadcastreceivers set in the manifest. Example 3: A service running with START_STICKY using 5 registered broadcastreceivers. What is the true difference in battery usage/ram/cpu between an observer and a receiver? Can any pros chime in on this? I'm assuming 1 instance wouldn't

BroadcastReceiver works for a while, then stops

扶醉桌前 提交于 2019-12-05 11:46:57
I'm developing an android app that responds to incoming calls. I've set up a broadcast receiver, set the permission and intent filter in the manifest file, and a lot of the time, it works. I can kill all apps, reboot the phone and it still works.. However, sometimes it doesn't react, and after this happens once, it doesn't respond after a reboot either. I've been struggling with this for about a month and it's driving me bananas. I really need my app to respond every time an incoming call is received. I've tried trimming out all code, and just displaying a Toast message when a call is received

Stop SMS from moving to Inbox

倖福魔咒の 提交于 2019-12-05 10:49:55
Before Android 4.4 I was able to stop messages from moving to inbox by setting the priority like this <receiver android:name="com.serviceschedular.helperClasses.SmsReceiver" > <intent-filter android:priority="1000"> <action android:name="android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> and then abortBroadcast() in onRecieve() messages. However in Android 4.4 we need to define SMS_DELIVER_ACTION in order to make our messaging app as default : Getting Your SMS Apps Ready for KitKat By doing this I can receive messages first and they don't move to any other messaging app

SMS cannot be prevented using abortBroadcast()?

≯℡__Kan透↙ 提交于 2019-12-05 10:49:47
I am working on a sms blocker application, in which i am using broadcast receiver and abortBroadcast() method - as many ppl have suggested here - to prevent messages from reaching inbox and alerting the user. But in my case, when I send a sms using the emulator, the SMS message won't get blocked, and reaches the inbox, also I get an error : 06-29 09:19:05.854: E/BroadcastReceiver(868): BroadcastReceiver trying to return result during a non-ordered broadcast which doesn't terminate the app in the emulator, however the application gets terminated when I test it on my phone. And yes, I have set