broadcastreceiver

How to send data from BroadcastReceiver to Fragment in android

孤者浪人 提交于 2019-12-11 04:35:13
问题 I am trying to make an chatting app.I have a SlidingDrawer Activity and it has many fragments and among which ChatFragment is one.Now when i am sending message to my friend , i have a Chatting Window and if any message comes from GCM service and i am in ChatFragment then this message will go to that Fragment and update the listview as i want to update the chatWindow when any message comes while chatting Now I tried to do like below. GcmIntentService : public class GcmIntentService extends

DownloadManager and Android 7.0 Cancel feature

坚强是说给别人听的谎言 提交于 2019-12-11 04:28:50
问题 Android N brought the "cancel" feature directly on the download notification if you're using the DownloadManager . Did they add any intent-filter action to catch this event ? At this point DownloadManager gets only 3 actions : ACTION_DOWNLOAD_COMPLETE ACTION_NOTIFICATION_CLICKED ACTION_VIEW_DOWNLOADS I tried to use ACTION_NOTIFICATION_CLICKED to cancel manually my download but if the user clicks on the "Cancel" button, I'm not notified. 回答1: The DownloadManager should send ACTION_DOWNLOAD

Send data about charging between broadcast and activity with Shared Preferences [android]

雨燕双飞 提交于 2019-12-11 04:26:51
问题 I'm using BroadcastReceiver to send information about status of battery charging to my Main Activity. App uses SharedPreferences to send data. The problem is when my phone is connected or disconnected to charge. The app is crashed. I think this is problem with SharedPreferences . Am i right? And what i should do to get in working well? This is my BroadcastReceiver class: public class PowerConnectionReceiver extends BroadcastReceiver { SharedPreferences pref; public void onReceive(Context

Android application without GUI

折月煮酒 提交于 2019-12-11 03:59:40
问题 I have been developing a simple application without UI using broadcast receiver. The app doesn't contain any ACTIVITIES. I have given necessary permissions. I took the code from this url:http://developerandro.blogspot.in/2013/09/check-internet-connection-using.html The app shows a toast "Not connected to internet" when I click change wifi state. It's working correctly. But my question is There is an activity registered in my manifest file which I don't have. So I delete those lines from my

Android Sms Broadcast Listener not working

拥有回忆 提交于 2019-12-11 03:50:45
问题 Even the Log.d is not being called. Can't find the error. I have looked at Android - SMS Broadcast receiver, Android – Listen For Incoming SMS Messages. I have been looking for the solution for last 24 hours or so. Please see and tell where I am wrong. No exceptions are thrown. SmsListener is in my package folder, where all other activities are placed. Update added android:enabled="true" to receiver. Then also not worked. I have in my manifest: <uses-permission android:name="android

Android long running service with alarm manager and inner broadcast receiver

非 Y 不嫁゛ 提交于 2019-12-11 03:30:02
问题 I have a Service that uses a custom Connection class (extends thread) to a hardware controller. When the User prefers, I wish to maintain this connection on a permanent basis. I already have the code to handle when the Android device loses its internet connection, switches between wi-fi, etc. In order to stay connected, the controller requires that you speak to it within every 5 minutes. I currently, within the Connection class start a thread that runs in a while(), and checks the system time

Alarms not always triggering android

一个人想着一个人 提交于 2019-12-11 03:22:33
问题 *I am developing an Android application which triggers an alarm at certain time that the user selects. But the problem is this alarm is only triggered if the user sets it to a little amount of time from now. So it's like if the app is not running the alarm won't trigger. I already acquired a lock and also set the flags to keep the screen on. Sometimes when I set it to 15 minutes from now or something like that it works and then I try again and it doesn't. I also included the broadcast

Avoid registering duplicate broadcast receivers in Android

喜夏-厌秋 提交于 2019-12-11 03:08:49
问题 I am trying to create my first Android app. I would like a main-thread Activity (in my case: an ActionBarActivity) to receive notification of an event from a background Activity (in my case: an IntentService). I've read that using broadcasts should be the best way to do this. To register a Broadcast Receiver for listening to broadcasts sent from the background activity, I am using the following code inside the main-thread activity: // Register broadcast receiver LocalBroadcastManager bManager

Broadcast Receiver ACTION_SEND does not show up

烂漫一生 提交于 2019-12-11 02:54:57
问题 i want to use a broadcast receiver for "implicit intents" who use the type ACTION_SEND. It's still very basic but anyway my app/receiver already does not show up, no matter which app's "share menu" i try. excerpt from AndroidManifest.xml: <receiver android:name=".SaveReceiver" > <intent-filter android:icon="@drawable/ic_launcher" android:label="YourDrive" > <action android:name="android.intent.action.SEND" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> <intent

delete incoming message from inbox in android

别等时光非礼了梦想. 提交于 2019-12-11 02:35:42
问题 i want to delete incoming message from the inbox and just want to receive in my app i am trying this code but it is not working, i am using lollipop public class SmsReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if(intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")){ Bundle bundle = intent.getExtras(); //---get the SMS message passed in--- SmsMessage[] msgs = null; String msg_from = null; String msgBody = null; if