broadcastreceiver

Android dynamic and static BroadcastReceivers

99封情书 提交于 2019-12-09 03:48:53
问题 I'm about to insert some reminders on my app. Each of them will have different time. Reading about BroadcastReceiver the static version runs even when an app isn't running. Dynamic version only when app is alive, being destoyed on onPause and recreated on onResume. Because I'm inserting reminders, do I need to create static receivers for each of my reminders or not? Is the right way to handle reminders with different times? 回答1: Static or Dynamic? We may assume that reminders may be set for

Sending an intent from broadcast receiver to a running service in android

做~自己de王妃 提交于 2019-12-09 01:52:35
问题 Here is a my broadcast receiver. public class SmsReceiver extends BroadcastReceiver { @Override public void onReceive(Context ctx, Intent intent) { Log.d(DEBUG_TAG, SmsReceiver.class.getSimpleName()+ " action: " + intent.getAction()); // here is codes for sending intent to my running service } } here is broadcast receiver and service nodes in my manifest xml file. <service android:name=".SMSGatewayService" /> <receiver android:name=".SmsReceiver"> <intent-filter> <action android:name="android

what is the right way to clear background activity/activites from stack?

拟墨画扇 提交于 2019-12-09 01:49:10
问题 as the questions title says - I need to know what is the best way to "remove"/destroy/finish an activity that are somewhere in the middle of stack and currently on pause mode (not specific instances - but specific derived classes). for example: if the current state of the stack looks like this: ActivityD <-- top of the stack, currently forground ActivityC ActivityA ActivityC ActivityA a request to "clear" all ActivityC instances would cause the stack to be like: ActivityD <-- still top of the

how to detect long press of volume button in android

Deadly 提交于 2019-12-09 01:44:14
问题 I am working on application in which i want to provide facility to user to do specific thing when you long press up or down volume button no matter my app is background or foreground. I also want to implement this functionality when phone screen off but in stack-overflow posts says you cant do that. i have used android.media.VOLUME_CHANGED_ACTION broadcast listener for volume button press detection and it work fine no matter your app is background but thing is that i want to detect Long press

Using BroadcastReceiver with functionality of PhoneStateListener

五迷三道 提交于 2019-12-09 00:57:15
问题 I am trying to make a MissCall App which sends a message automatically when a miss call is received. I had completed my app and it worked fine ! Here is the complete scenario : Problem : The app was working fine but when i restarted the device the app didn't work ! . It only worked when i started my App atleast once after that it worked fine till it is switched off . Here is my code : package com.example.misscallapp; import android.content.Context; import android.content.Intent; import

Set extras for DownloadManager's BroadcastReceiver [duplicate]

♀尐吖头ヾ 提交于 2019-12-08 20:19:17
问题 This question already has answers here : Pass data to BroadcastReceiver from Activity using DownloadManager (4 answers) Closed 3 years ago . There's a way to put extras in DownloadManager 's intent registered for action DownloadManager.ACTION_DOWNLOAD_COMPLETE (e.g. receive a boolean value set as extra in the intent)? This is how I create the request: DownloadManager.Request req = new DownloadManager.Request(myuri); // set request parameters //req.set... DownloadManager downloadManager =

READ_PRIVILEGED_PHONE_STATE permission error

心已入冬 提交于 2019-12-08 16:47:13
问题 I have created an app that monitors calls (incoming and outgoing) and during the time that phone is ringing , it shows details about the number. everything is fine in incoming calls , but when user make an outgoing call app crashes with this error : 05-14 23:14:36.376 1427-1475/? W/BroadcastQueue: Permission Denial: receiving Intent { act=android.intent.action.PHONE_STATE flg=0x10 (has extras) } to ir.apptune.antispam/.CallReceiver requires android.permission.READ_PRIVILEGED_PHONE_STATE due

Android 7 BroadcastReceiver onReceive intent.getExtras missing data

强颜欢笑 提交于 2019-12-08 16:19:42
问题 My app isn't working on Android 7. My BroadcastReceiver.onReceive method is called but the contents of the intent.getExtras is missing. I've verified that the data was correctly loaded. Here's a snippet from my onReceive method, where intent is passed as a parameter to onReceive. Bundle bundle = intent.getExtras(); textMessage = bundle.getString("TEXT_MESSAGE"); ArrayList<MyPhoneNumber> phoneNumbersToText = bundle.getParcelableArrayList("PHONE_NUMBERS"); Both textMessage and

Error Receiving Broadcast Intent Problem

戏子无情 提交于 2019-12-08 14:40:16
问题 I created a broadcast receiver in the main activity and the background service which is sending broadcast intents. The application crashes each time I try to run it and the Log displays the following error message: 10-04 13:30:43.218: ERROR/AndroidRuntime(695): java.lang.RuntimeException: Error receiving broadcast Intent { action=com.client.gaitlink.CommunicationService.action.LOGIN_STATUS_UPDATE (has extras) } in com.client.gaitlink.GaitLink$LoginStatusReceiver@431690e8 The broadcast message

App not letting device to go into sleep mode

。_饼干妹妹 提交于 2019-12-08 13:05:39
问题 I'm developing an application in which I'm using an activity which will come on top of default lock screen of the device. All things are perfectly fine, but I'm having issues with display timeout of the screen . Every time when my activity comes, the device does not go into sleep mode. Why? Here is my code snippet for Service class and BroadcastReceiver class. I could find out what is hindering the device screen timeout mode. BroadcastReceiver class @Override public void onReceive(Context