broadcastreceiver

Android issue : Debug when phone off

自古美人都是妖i 提交于 2019-12-05 07:59:36
To Debug BroadcastReceiver when phone restart, I've tried Some Method but doesn't works and link as follow How to debug BOOT_COMPLETE broadcast receiver's "Force Close" crashes? force-close-crashes probably this is not the best way, but i had a similar problem and i used a sleep function of 30 seconds just at the beginning of the boot receiver onReceive method, so i had the time to go to the process list in DDMS perspective and put my app in debug mode, so the breakpoint on the first real instruction of the onReceive method it went hitted. hope this help swiftBoy Same situation I had earlier,

How to play audio file when call starts?

天涯浪子 提交于 2019-12-05 07:55:40
I am initiating a voice call from my application. Now i want that when the user on the other side picks up the call, i want to play a recorded audio file. How to go about this? Please help! I have found a workaround with this. I play an audio file on device's speakers with full sound when the phone state changes to TelephonyManager.CALL_STATE_OFFHOOK This ensures that the user on the other side can hear the recording. In simple and clear words you cant stream any sound on an Incoming call 来源: https://stackoverflow.com/questions/7495506/how-to-play-audio-file-when-call-starts

Broadcast Receiver for ACTION_USER_PRESENT,ACTION_SCREEN_ON,ACTION_BOOT_COMPLETED

随声附和 提交于 2019-12-05 07:54:04
I am creating a class which uses broadcast receiver. I want to receive the broadcast on unlocking of the phone. But there is some issue. Please help me out. My Manifest.xml is :- <receiver android:name=".MyReciever"> <intent-filter> <intent-filter> <action android:name="android.intent.action.ACTION_USER_PRESENT" /> <action android:name="android.intent.action.ACTION_BOOT_COMPLETED" /> <action android:name="android.intent.action.ACTION_SCREEN_ON" /> </intent-filter> </intent-filter> </receiver> and my Broadcast reciever class :- public class MyReiever extends BroadcastReceiver { @Override public

Google Awareness Api events while app isn't running

自古美人都是妖i 提交于 2019-12-05 07:48:23
I would like either a BroadcastReceiver or IntentService (depending on how long my eventual processing takes) to start when a Google Awareness API "fence" fires. For example, perhaps I want to know how many times I activate a set of beacon fences over the course of the day (assuming I keep my phone with me). All the examples I've found show registering broadcast receivers in code, but my understanding is that I would need to register a broadcast receiver in the manifest in order for the OS to send the broadcast to it if my app isn't running. What's more, the intent ID appears to be a custom

Is android.intent.action.DOWNLOAD_COMPLETE an explicit broadcast?

吃可爱长大的小学妹 提交于 2019-12-05 07:35:56
My app (targetSdk=25) has a broadcast receiver defined in the manifest as follows: <receiver android:name="my.package.DownloadManagerReceiver" android:exported="true"> <intent-filter> <action android:name="android.intent.action.DOWNLOAD_COMPLETE" /> </intent-filter> </receiver> My DownloadManagerReceiver is notified whenever Android's DownloadManager finishes downloading a file, so I can do some processing on the file that was downloaded. I'm working on migrating my app's targetSdk to 27 (Oreo). According to https://developer.android.com/about/versions/oreo/background#broadcasts , implicit

unregister broadcast receiver registered through manifest

大憨熊 提交于 2019-12-05 07:33:56
Is it possible to unregister a BroadcastReceiver that has been registered through manifest? Also please let me know if it possible to ignore the BroadcastReceiver , without making any code changes, as this BroadcastReceiver is of no use to me now. Thanks. You can disable Receiver with this code: PackageManager pm = getPackageManager(); ComponentName compName = new ComponentName(getApplicationContext(), MyReceiver.class); pm.setComponentEnabledSetting( compName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); Also you can use COMPONENT_ENABLED_STATE_ENABLED to

App doesn't auto-start an app when booting the device in Android

丶灬走出姿态 提交于 2019-12-05 07:28:27
问题 I have managed to implement the following method coding that allows the app to perform an auto-launch when the device is booted/started-up. However, when I tested out the implementation code, it failed to work, the app has failed to perform an auto-launch when the device is booted. Can anyone please help or advice me what could be the possibilities? Thank you. Manifest.xml <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"> </uses-permission> <receiver android:enabled=

android hide application from the list of applications and launch it from broadcast receiver

僤鯓⒐⒋嵵緔 提交于 2019-12-05 06:55:43
问题 I want to hide my app from the list of applications so a third person will not know that this app is installed. I saw that this can be achieved by : If you want to hide your application from Application Launcher, then just do not include android.intent.category.LAUNCHER in any of your activities. I tried this and it is working . Now i need to define a shortcut to launch my app. I am trying to achieve this by a broadcast receiver for outgoing call . SO i will check in my onreceive if the

BroadcastReceiver on android.net.conn.CONNECTIVITY_CHANGE called multiple times

孤者浪人 提交于 2019-12-05 06:26:47
I have the following in my manifest <receiver android:name=".receiver.WifiReceiver" > <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> </receiver> and the following BroadcastReceiver: public class WifiReceiver extends BroadcastReceiver { private static String TAG = makeLogTag(WifiReceiver.class); @Override public void onReceive(Context context, Intent intent) { ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = null; if (connectivityManager != null) {

Can't receive broadcast Intent of UsbManager.ACTION_USB_DEVICE_ATTACHED/UsbManager.ACTION_USB_DEVICE_DETACHED

大城市里の小女人 提交于 2019-12-05 03:39:41
I am coding an USB host App recently, but it's stucked because I can't detect the device attached/detached event, I followed the coding note of http://developer.android.com/guide/topics/connectivity/usb/host.html and refer to other's coding in the network, After checking several times, I still can't find the problem. After my debugging, it seems that the UsbManager.ACTION_USB_DEVICE_ATTACHED/UsbManager.ACTION_USB_DEVICE_DETACHED intent is not happened, Because I try to use Context.sendBroadcast() to send a customized Intent, and my BroadcastReceiver can receive the intent. But when I attach