broadcastreceiver

Dynamic register of C2DM receiver using registerReceiver

橙三吉。 提交于 2019-12-22 06:23:36
问题 I can register my android app with C2DM successfully using a <receiver> in my manifest. However, if I delete the <receiver> from the manifest and register my receiver using the method registerReceiver of the context, I receive a SERVICE_NOT_AVAILABLE error response. I have reproduced this behaviour in the emulator and in a real device. Is dynamically registering a C2DM receiver possible? This is the fragment of the manifest I deleted: <receiver android:name=".service.C2DM.C2DMReceiver"

No ringing event on incoming calls

℡╲_俬逩灬. 提交于 2019-12-22 06:16:30
问题 I don't know where is a problem. Listener doesn't catch onRinging event (so I can decide will I accept or reject incoming calls). in manifest is this: <uses-permission android:name="android.permission.USE_SIP" /> in main activity onCreate is this: IntentFilter filter = new IntentFilter(); filter.addAction("android.SipDemo.INCOMING_CALL"); callReceiver = new IncomingCallReceiver(); this.registerReceiver(callReceiver, filter); ... SipManager manager = SipManager.newInstance(this); Intent i =

Broadcast Receiver for ACTION_USER_PRESENT,ACTION_SCREEN_ON,ACTION_BOOT_COMPLETED

穿精又带淫゛_ 提交于 2019-12-22 05:31:18
问题 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>

BroadcatReceiver declared in manifest.xml not receiving LocalBroadcastManager intents

早过忘川 提交于 2019-12-22 04:43:46
问题 While it is possible to declare a 'Local' BroadcastReceiver via code so it receives intents published via a LocalBroadcastManager.Ex LocalBroadcastManager.getInstance(this).registerReceiver(new FooReceiver(), new IntentFilter("foo_intent_filter")); I wonder if it is possible to declare such receiver via the manifest .xml (cleaner) . When I use the 'manifest way', the receiver is not 'receiving' the intents. <receiver android:name="FooReceiver" android:enabled="true" android:exported="false" >

Are you missing a call to unregisterReceiver() ? in android

拟墨画扇 提交于 2019-12-22 04:00:58
问题 I get the following error : "Are you missing a call to unregister receiver" android.app.IntentReceiverLeaked: Activity com.apps.activities.MainActivity has leaked IntentReceiver com.wwhere.fragment.MainRecyclerViewFragment$1@44d50ba8 that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:809) at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:610) at android.app.ContextImpl

Incorrect extras received with all intents but the first one

孤者浪人 提交于 2019-12-22 03:45:17
问题 I have a small application which can be used to set reminders for future events. The app uses an AlarmManager to set the time for when the user should be reminded. When the alarm goes off, a BroadcastReceiver registers this and in turn starts a service to notify the user via a toast and a notification in the status bar. In order to display the correct information in the notification and toast, some extra information is passed along with the intent. The first time a reminder is registered, the

Incorrect extras received with all intents but the first one

强颜欢笑 提交于 2019-12-22 03:45:07
问题 I have a small application which can be used to set reminders for future events. The app uses an AlarmManager to set the time for when the user should be reminded. When the alarm goes off, a BroadcastReceiver registers this and in turn starts a service to notify the user via a toast and a notification in the status bar. In order to display the correct information in the notification and toast, some extra information is passed along with the intent. The first time a reminder is registered, the

How to pass a parameter to a subclass of BroadcastReceiver?

て烟熏妆下的殇ゞ 提交于 2019-12-22 03:42:07
问题 I managed to get my headset buttons get recognized by my app when pressed, but one of the buttons needs to call a method that's in MyCustomActivity. The problem is onReceive's 1st parameter is a Context that cannot be cast to Activity and using a MyCustomActivity's inner class won't work in Android 4.1 unless it is static (which has the same problem of inability to access MyCustomActivity's method. So the only option left for me (in order to support both 2.x and 4.1) is to pass the activity

Get widget id from BroadcastReceiver

大城市里の小女人 提交于 2019-12-22 01:32:44
问题 I need to know the widget id inside onReceive(). I thought to associate the selected item informations of the configure activity to the new widget id, and then save them to sharedpreferences so that i can know what to do inside onReiceive() by reading from sharedpreferences Configure activity: resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetId); setResult(RESULT_CANCELED, resultValue); listView.setOnItemClickListener(new OnItemClickListener() {

How to detect that i have received an email/gmail on my Android Device?

痞子三分冷 提交于 2019-12-22 01:30:53
问题 Is there a way to detect or an event being triggered when i receive a gmail/email on my android device. Basically i would like my application to read the email notification when i receive it. Could you kindly tell me if there is way to do this ? 回答1: You need to register a content observer (not broadcast receiver) contentResolver.registerContentObserver(Uri.parse("content://gmail-ls"), true, gmailObserver); gmailObserver is your own ContentObserver object. ContentObserver.onChange is going to