broadcastreceiver

broadcasting of BOOT_COMPLETED intent action does not work properly

不问归期 提交于 2019-12-19 09:08:08
问题 I have a receiver class listening on several actions but it can not catch the android.intent.action.BOOT_COMPLETED action. What I am doing wrong? here is my manifest file: <uses-sdk android:minSdkVersion="7" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <!--<receiver android:name=".OtherReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver>--> <receiver android:name="com.myApp.AppReceiver"

Can iOS receive broadcasts like Android?

谁说胖子不能爱 提交于 2019-12-19 08:10:11
问题 I would like my app to be informed when a headset/headphones is disconnected from an iOS device after a period of idle time long enough for the app to have been cleaned up (and thus might not be running) similar to how a BroadcastReceiver works in android. I suspect it's not possible but would appreciate any ideas. I have looked into local and push notifications and the NSNotificationCenter. Push notifications aren't appropriate because events happen on the device. It only seems possible to

Android: How can I completely abort/remove sticky broadcast

和自甴很熟 提交于 2019-12-19 03:13:59
问题 We can remove an ordered broadcast with abortBroadcast() , is there a way to completely remove a sticky ordered broadcast ? 回答1: removeStickyBroadcast is exactly what you need: public abstract void removeStickyBroadcast (Intent intent) Since : API Level 1 Remove the data previously sent with sendStickyBroadcast(Intent) , so that it is as if the sticky broadcast had never happened. You must hold the BROADCAST_STICKY permission in order to use this API. If you do not hold that permission,

Android widget stops working after a while?

泪湿孤枕 提交于 2019-12-19 02:39:09
问题 I have a flashlight app with a widget. The widget is used to turn the flashlight on and off and does not display main activity or anything. After a few hours, however, the widget does nothing. I mean if you click it, nothing happens. I have two classes to accomplish this a Provider and a Receiver . Provider: public class WidgetProvider extends AppWidgetProvider { @ Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { Intent receiver = new

Activity has leaked IntentReceiver - LollipopBrowserAccessibilityManager

若如初见. 提交于 2019-12-18 19:27:16
问题 I hope to find some help here because I'm not familiar with BroadcastReceivers in Android. This piece of code opens a WebView redirect you to a login page and receives the login token once a URL change is detected. After that, the Activity is closed. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mLoginWebView = (WebView) findViewById(R.id.webview_login); redirectUrl = getString(R.string.app_redirect

Send data to the alarm manager broadcast receiver

◇◆丶佛笑我妖孽 提交于 2019-12-18 19:08:31
问题 I am missing something here and I hope someone can help me out. I am setting up an alarm using the following: AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); Intent broadcast_intent = new Intent(this, AlarmBroadcastReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, broadcast_intent, 0); broadcast_intent.putExtra("test", "ValueReceived"); //data to pass Date date = someVariable.getDateTime(); long triggerAtTime = date.getTime();

BroadcastReceiver trying to return result during a non-ordered broadcast - PACKAGE_ADDED in Android

三世轮回 提交于 2019-12-18 18:37:48
问题 I am getting this exception in my below given code. i don't have any idea what is wrong with this code. Please help me out to get rid of this exception. 05-23 23:33:49.853: E/BroadcastReceiver(26895): BroadcastReceiver trying to return result during a non-ordered broadcast 05-23 23:33:49.853: E/BroadcastReceiver(26895): java.lang.RuntimeException: BroadcastReceiver trying to return result during a non-ordered broadcast 05-23 23:33:49.853: E/BroadcastReceiver(26895): at android.content

Broadcast data to multiple widgets in Flutter

橙三吉。 提交于 2019-12-18 17:26:50
问题 Is there a way to broadcast data from one widget to other widgets? Similar to a BroadcastReceiver on Android or NSNotificationCenter on iOS. Specifically, I'm trying to detect when a Navigator pops or pushes a new view. I added navigatorObservers to MaterialApp. And when a widget comes back to the foreground, I want to be able to notify it by broadcasting changes from didPush and didPop with the actual route that's in the current foreground 回答1: Navigator.push returns a Future that will

Explicit addressing an Intent to a dynamically broadcast receiver

拈花ヽ惹草 提交于 2019-12-18 15:04:35
问题 i am new to Android and trying to understand the communication between apps. I am trying to write 3 little apps which can communicate with each other. If you want to sent a message to everybody you just use an implicit broadcast. implicit Intent intent.setAction("com.example.myChatMessage") if you want to adress only 1 specifc receiver i did it with explicite Intent intent.setComponent("com.example.test.android.broadcastreceiver.b", "com.example.test.android.broadcastreceiver.b

Toast message from Broadcast Receiver

懵懂的女人 提交于 2019-12-18 14:12:13
问题 I have a broadcast receiver and I am trying to show a toast message from it, is this possible ? This code doesn't show the toast but it print the log message in the logcat. Is there some idiotic thing I am doing or what is my problem ? @Override public void onReceive(Context context, Intent intent) { Log.v("log", "this is shown"); Toast.makeText(context, "this is not shown" , Toast.LENGTH_LONG); } 回答1: Call the show() method for the Toast . 回答2: you forgot to call show() on the Toast ..