broadcastreceiver

Notification deleteIntent does not work

梦想与她 提交于 2019-11-28 09:09:33
I've read several questions concerning similair issues, but they do not provide me with the solution. In my Android app I fire off a notification (in the Application class to be specific, which is actually started from a C2DM push event). I then want to receive an Intent when the "clear all" button is pressed on the notifications: notification.deleteIntent = PendingIntent.getService(this, 0, new Intent(this, NotificationDeleteReceiver.class), 0); In my NotificationDeleteReceiver.class I got the onReceive method: public class NotificationDeleteReceiver extends BroadcastReceiver { @Override

Android - getting “can't deliver broadcast” error on dynamically registered broadcast receiver

喜欢而已 提交于 2019-11-28 09:00:23
问题 I'm trying to perform a relatively simple task: I have a fragment that starts a service to pull some JSON from a remote server. I then want to pass that JSON back to the original calling fragment using a broadcast, with the BroadcastReceiver defined as an anonymous class in the fragment. However, whenever I try to do this, I keep getting the following error: E/AndroidRuntime: FATAL EXCEPTION: main Process: com.roundarch.codetest, PID: 21974 android.app.RemoteServiceException: can't deliver

BroadcastReceiver not called when screen locked in Android

ぃ、小莉子 提交于 2019-11-28 08:44:54
问题 In my Application, when a notification arrives, the BroadcastReceiver is not called if the screen is locked. But when screen is unlocked, the BroadcastReceiver is called and displays the notification. I also put the following permission in my manifest: android.permission.WAKE_LOCK But still not working. 回答1: Here's the code that works for me: NotificationManager mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new Notification(...);

Boot Receiver not working

女生的网名这么多〃 提交于 2019-11-28 08:31:48
Manifest: <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".AlarmActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> </intent-filter> </activity> <receiver android:name="CallReciver"> <intent-filter> <action android:name="android.intent.action.PHONE_STATE"> </action> </intent-filter> </receiver> <receiver android:name=".SmsReceiver"> <intent-filter android:priority="1000"> <action android:name= "android.provider.Telephony.SMS_RECEIVED" /> </intent-filter> </receiver> <receiver

Broadcast receiver not working in android oreo

…衆ロ難τιáo~ 提交于 2019-11-28 08:31:21
My Broadcast receiver is not working on oreo but its working below oreo it's working fine, I searched a lot regarding this but could not find the suitable solution. Does anyone face the same problem, here is my code regarding my service in which broadcast has been implemented. Kindly suggests me that how I can make in working in oreo. Here is the class public int onStartCommand(Intent intent, int flags, int startId) { mContext = this; mAppPreferences = new AppPreferences(mContext); if (intent.getExtras() != null) { data = (String) intent.getExtras().get("showPopUp"); phoneNumber= (String)

Android - How to use a local broadcast receiver?

烂漫一生 提交于 2019-11-28 08:06:45
问题 I'm trying to use a local broadcast receiver. In order to do so I"ve done the next steps - 1) At an Activity, where Iwould like something to happen, I've created a class - private class NewGroupReceiver extends BroadcastReceiver{ @Override public void onReceive(Context context, Intent intent) { Log.d("The group ", "GOT IN THE RECIVING"); Toast.makeText(this, "Working",Toast.LENGTH_SHORT).show(); } } 2) At the same activity I've used the next code in order to create a receiver - @Override

Battery broadcast receiver declared in manifest file does not work?

一个人想着一个人 提交于 2019-11-28 08:00:42
问题 There are two ways to make a broadcast receiver known to the system: One declares it in the manifest file with this element. The other is to create the receiver dynamically in java code. Now, the receiver has been created dynamically in java code and it does work normally.But why the first way "Declare in the manifest file" failed? Is there anyone to success? Thanks. AndroidManifest.xml <receiver android:name="pj.batteryinfo.BatteryReceiver"> <intent-filter> <action android:name="android

BroadcastReceiver not working when app is not running

这一生的挚爱 提交于 2019-11-28 07:57:14
问题 In my manifest file I have declared the receiver. (as follows) <receiver android:name=".OnAlarmReceive" /> however, once I shut down my application, I am not able to get the alarms and the notifications. Apparently, a call to the OnReceive in my Broadcast receiver is never made. public class OnAlarmReceive extends BroadcastReceiver { @Override public void onReceive(Context context, Intent arg1) { //various stuff } } Inside the MainActivity, my alarm manager class is as the follows.

How to determine the sender of Broadcast Intent

一世执手 提交于 2019-11-28 07:56:58
问题 I have an application that is at the same time a broadcast sender and receiver of standard action android.intent.action.SET_WALLPAPER. I want to do some stuff only in a case when another application broadcasted this intent. Is there any way to determine who initiated a broadcast in onReceive method of a BroadcastReceiver? 回答1: No. If you only want to do something when an action was broadcast by another app (i.e. not yours), I imagine it should be easy to determine that your app didn't send

Communicate between different instances of same fragment

限于喜欢 提交于 2019-11-28 07:53:41
问题 The problem as follows. Let us have 3 tabs with fragments: Tab 1 (Fragment A). Needs to send data to Tab 2. Tab 2 (Fragment B). Needs to receive data from Tab 1. Tab 3 (Fragment B). Already contains data. As you see Tab 3 and Tab 2 contain the same Fragment but different instances. How do I send data (not via arguments) to exactly Tab 2? What I've tried: Set the unique ID for Fragment B via arguments when they were created. Register same Local Broadcast Receiver for both instances of Fragment