android-broadcast

Broadcast Receiver Not Working After Device Reboot in Android

假装没事ソ 提交于 2019-12-17 07:03:11
问题 I have already checked all the related questions and have not found any solution for this problem. So this is an absolutely new problem for me. What I Have I have an Android app which registers a few broadcast receivers in its manifest. This is what my manifest looks like. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.app.myapp"> <uses-permission android:name="android

Broadcast Receiver Not Working After Device Reboot in Android

柔情痞子 提交于 2019-12-17 07:03:06
问题 I have already checked all the related questions and have not found any solution for this problem. So this is an absolutely new problem for me. What I Have I have an Android app which registers a few broadcast receivers in its manifest. This is what my manifest looks like. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.app.myapp"> <uses-permission android:name="android

How to check if Receiver is registered in Android?

旧巷老猫 提交于 2019-12-17 04:44:16
问题 I need to check if my registered receiver is still registered if not how do i check it any methods? 回答1: I am not sure the API provides directly an API, if you consider this thread: I was wondering the same thing. In my case I have a BroadcastReceiver implementation that calls Context#unregisterReceiver(BroadcastReceiver) passing itself as the argument after handling the Intent that it receives. There is a small chance that the receiver's onReceive(Context, Intent) method is called more than

Google now won't let my app detect headset button long click

不羁的心 提交于 2019-12-14 02:33:49
问题 I want my app to do some specific actions when user long clicks (press and hold) headset button. I use a BroadcastReceiver for MEDIA_BUTTON and it works fine in phones who doesn't run Google now app for sound actions for long press. But in the phones that automatically run Google now my app is just being ignored. How can I disable Google now and detect headset button long click. here is onReceive method in my BroadcastReceiver class. public void onReceive(Context context, Intent intent) {

Android - Using URI permissions with broadcast

冷暖自知 提交于 2019-12-14 02:18:26
问题 I am trying to test whether URI permissions work with Broadcast. The first app I have has the following code in an activity : Intent intent = new Intent("com.android.testintent.app.bcast"); intent.setData(contentUri); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); sendBroadcast(intent); The content URI is obtained from a FileProvider. <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.android.provider.DataSharing" android:exported="false"

Perform long running operations when receiving SMS on API < 21

戏子无情 提交于 2019-12-13 20:24:11
问题 I'm building an app that will listen for incoming SMS messages, perform some potentially long running operations and send back a reply if some conditions are met. I've got the listening part working using a BroadcastReceiver , but I'm not sure how/where to perform the potentially long running operations. The Android Developer Documentation states that After onReceive(), the system can kill the process at any time to reclaim memory, and in doing so, it terminates the spawned thread running in

How to detect Android Application Boot/Launcher [closed]

六月ゝ 毕业季﹏ 提交于 2019-12-13 11:06:55
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . How to detect Android application launcher/boot? And give some idea briefly. I want to detect launcher application. which application is launcher i want to push my password screen after that it will go to

How to detect bluetooth call/media button press in android app

落花浮王杯 提交于 2019-12-13 07:15:42
问题 I need to detect the bluetooth device button click in my application. i followed many stackoverflow links, but doesn't seem to work for me. I am using the broadcast receiver as shown below: public class RemoteControlReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())) { KeyEvent event = (KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT); if (KeyEvent.KEYCODE_MEDIA_PLAY ==

Intent Service do not get started when called from a broadcast receiver

こ雲淡風輕ζ 提交于 2019-12-13 04:34:44
问题 I am working on an app in which on receiving a message i need to start a service. But my Intent service is not running. Here is what I am doing: Broadcast Receiver: public void onReceive(Context context, Intent intent) { this.con=context; Toast.makeText(context,"Broadcast received", Toast.LENGTH_LONG).show(); Bundle bundle = intent.getExtras(); Object[] messages = (Object[])bundle.get("pdus"); SmsMessage[] sms = new SmsMessage[messages.length]; for(int i=0;i<messages.length;i++) { sms[i] =

Android : Broadcast when screen lock appear

浪尽此生 提交于 2019-12-13 04:13:27
问题 I want to run a method when android phones screen lock appear. I tested ACTION_SCREEN_ON as a broadcast, but it only works when the activity is live. I also tested ACTION_USER_PRESENT and it works when the phone is unlocked, but I want to run the method before unlocking (just when the screen lock appears). I also tested AlarmManager by repeating alarm every 1 minute, but this solution has two defects: Battery soon gets empty. It's a deprecated way, and I don't need to do method every 1 minute