broadcastreceiver

Creating a Notification at a particular time through Alarm Manager

情到浓时终转凉″ 提交于 2019-11-30 09:55:10
I am trying to create a notification at a particular time. Im creating a broadcast receiver and calling it through the AlarmManager. Problem is that the broadcast is not received and that I am not getting any notifications. Registering the Broadcast Receiver in the Manifest, <receiver android:name="com.example.android.receivers"> <intent-filter> <action android:name="com.example.android.receivers.AlarmReceiver" /> </intent-filter> </receiver> This is the Broadcast Receiver, public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context pContext, Intent pIntent)

Android-Broadcast Receiver and Intent Filter

南笙酒味 提交于 2019-11-30 09:37:57
I am new to android platform.please help me out how the Broadcast Receiver and Intent Filter behaves in android.please explain in simple line or with example.thanks in advance... RoflcoptrException A broadcast receiver is a class in your Android project which is responsible to receive all intents, which are sent by other activities by using android.content.ContextWreapper.sendBroadcast(Intent intent) In the manifest file of you receicving activity, you have to declare which is your broadcast receiver class, for example: <receiver android:name="xyz.games.pacman.network.MessageListener"> <intent

Volume change Listener: Is registerMediaButtonEventReceiver preferable to onKeyDown?

蹲街弑〆低调 提交于 2019-11-30 09:30:24
Looking for a "most comprehensive & compatible (i.e. all Android versions...)" way to listen to volume changes, I found 2 different approaches to handle this: registerMediaButtonEventReceiver onKeyDown + SettingsContentObserver Which method is preferable? And why? UPDATE 1: Thanks to the comment below, I discovered that onKeyDown() actually takes over the volume key, which may not be a complete solution as one of the posts mentioned that volume could be changed via interfaces other than the hardware buttons (not to mention that Google seems to be gradually taking away those "take over"

Get intent filter for receivers

拜拜、爱过 提交于 2019-11-30 08:59:29
I am trying to get a list of receivers that handle android.intent.action.BOOT_COMPLETED for other applications. I can get only the apps with that action with this: final PackageManager pm = getPackageManager(); final Intent intent = new Intent("android.intent.action.BOOT_COMPLETED"); final List<ResolveInfo> activities = pm.queryBroadcastReceivers(intent, 0); for (ResolveInfo ri : activities) { Log.i(TAG, "app name: " + ri.loadLabel(pm)); } I can get a list of receivers with this code: final List<PackageInfo> packs = pm.getInstalledPackages(PackageManager.GET_RECEIVERS); for (final PackageInfo

BroadcastReceiver declared in manifest is not receiving the Broadcast

空扰寡人 提交于 2019-11-30 08:49:47
I've tried to register a Wifi BroadcastReceiver to get the wifi state when it changes. But so far I have no luck receiving the broadcast. <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <receiver android:name=".WifiReceiver" > <intent-filter> <action android:name="android.net.wifi.WifiManager.WIFI_STATE_CHANGED_ACTION" /> <action android:name="android.intent.action.PHONE_STATE" /> </intent-filter> </receiver> //activity declaration here... </application> Do you guys know how to register the BraodcastReceiver in manifest? I don't want to register it in

What is the use of android:exported=“true” in BroadcastReceiver

偶尔善良 提交于 2019-11-30 08:19:27
Hi I see that some broadcast receiver use this tag android:exported="true" in Android Manifest.xml to register. <receiver android:exported="true" android:name="com.flyingsoftgames.googleplayquery.QueryReceiver"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver> What exactly the use of android:exported="true" to register broadcast receiver in Android ? Thanks in advance. From the Developer Guide : android:exported Whether or not the broadcast receiver can receive messages from sources outside its application — "true" if it can, and

SMS Received in my SMS app and in Hangouts, although I call abortBroadcast()

旧城冷巷雨未停 提交于 2019-11-30 07:38:19
I have an SMS blocker Android application developed myself which was working quite well capturing all the spams until recently Google updated its Hangouts app to work with SMSs. The Problem: SMS is getting captured by both my app and hangouts! Even though the message is blocked by my app and stored in its private database, it is also present in the hangouts app and thus in the stock Messaging app at the same time. Seems the abortBroadcast() isn't working any more. Everything was working perfectly before the Hangouts update. I had also tried fiddling with android:priority but in vain. Hangouts

Android BroadcastReceiver onReceive() called twice on android 4.0

落爺英雄遲暮 提交于 2019-11-30 06:53:10
问题 I faced to one problem on android 4.0.3 (on 4.1.2 it works fine). I have in my Activity BroadcastReceiver. When I send a broadcast, method onReceive() called always twice. Please give me any suggestions about BroadcastReceiver differences on 4.0 and 4.1 private final GcmBroadcastReceiver gcmReceiver = new GcmBroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { final String action = intent.getAction(); if (action != null && action.equals(MyBroadcastReceiver

When is the intent ACTION_DEVICE_STORAGE_LOW broadcasted?

限于喜欢 提交于 2019-11-30 06:38:24
问题 In my application, I have registered a broadcast receiver to receive the system intent ACTION_DEVICE_STORAGE_LOW. I was expecting this to be broadcasted whenever the phone had low internal memory. So, I downloaded a few extra apps (my phone has a very small internal memory) which caused the OS to display the notification that the system memory is low. The phone had 10 - 15 MB remaining. However, my broadcast receiver never received that intent. Yet, the system notification stays in the

BroadcastReceiver: can't instantiate class; no empty constructor

China☆狼群 提交于 2019-11-30 06:28:57
问题 I have inner class as broadcast receiver: public class ManualBacklightReceiver extends BroadcastReceiver { public static final String ACTION_MANUAL_BACKLIGHT = "com.android.systemui.statusbar.powerwidget.MANUAL_BACKLIGHT"; public ManualBacklightReceiver() { } @Override public void onReceive(Context context, Intent intent) { Log.d("ManualBacklightReceiver", intent.getAction()); } }; AndroidManifest: <receiver android:name=".statusbar.powerwidget.PowerWidgetGrid$ManualBacklightReceiver">