broadcastreceiver

Intercept / Get Data sent to Spotify Widget on Android

眉间皱痕 提交于 2019-12-12 13:12:21
问题 I have Spotify and want to use the title and Song name in my Application. (Final Goal would be to export it to my Liveview watch, so that I can contron Spotify with it) As there is a Spotify-Widget, I simply would like to add a Broadcast Recevier to get the Data sent to the widget. So I add a Broadcast receiver, and as far as I understand the concept, this should suffice and I then should be able to get the data Spotify sends to the widget. According to the Documentation, you can do

Exactly how much power is drained by registering a broadcast receiver for ACTION_BATTERY_CHANGED?

社会主义新天地 提交于 2019-12-12 11:26:16
问题 I am planning to write an app whose sole purpose will be to monitor the battery level, and launch an intent the moment it drops below a certain level. My one concern is that this itself will be a battery drain, and no one will want to use it. So my question is: Exactly how much power is drained by using the ACTION_BATTERY_CHANGED broadcast receiver? Does anyone know approximately how much battery life we're talking about? 回答1: I don't think you'll drain much power. This broadcast is sent only

Is there Pause action For Download Manager in Android?

半世苍凉 提交于 2019-12-12 10:39:44
问题 I'm using download manager class in android to download some files . This class can add and remove a request of downloading . Is there any way to pause a specific download then resume it ? Or Is there another way to do that ? Edit: I found this way, It's working: When pause downloading process, close the file we wrote on. When resume downloading, access to the file (not completed) and get its size Add downloaded bytes info to the header of httpRequest : mHttpRequset.setHeader("Range", "bytes=

BroadcastReceiver don't receive keypress on Camera button

ⅰ亾dé卋堺 提交于 2019-12-12 10:20:19
问题 I am trying to play some tone when my application is in background and I press on " Camera " button for that I am doing this simple steps. Creating BroadcastReceiver class public class CameraButtonListener extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { ToneGenerator tone = new ToneGenerator(AudioManager.STREAM_DTMF, 100); tone.startTone(0,2000); abortBroadcast(); } } Register BrodcastReceiver in onCreate methode. @Override public void onCreate

I am not getting the outgoing call phone number? both in emulator and real phone also getting null

懵懂的女人 提交于 2019-12-12 10:15:43
问题 call.java: public class Call extends Activity{ boolean timerhasstarted; Intent callIntent; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); call(); } void call() { String num="7829893070"; callIntent=new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+num)); if(!timerhasstarted) { startActivity(callIntent); ct.start(); timerhasstarted=true; } else { ct.cancel(); timerhasstarted=false; Toast.makeText

Receiving in app SMS messages only from certain specified numbers

和自甴很熟 提交于 2019-12-12 10:08:34
问题 I've recently set up an app that will receive sms messages and then display them as a toast on the main activity. Once the app has received an SMS it will abort broadcast and stop the message from going into the inbox. Currently it does this with all messages that the phone receives but I would like it to only carry out its job and display the toast when an SMS is received by a specific number. I know that it is a case of putting an if statement into my receiver code but I'm not too sure

How to know whether the phone is locked mode

拟墨画扇 提交于 2019-12-12 09:53:12
问题 HI guys is there a way for me to know whether the phone is in lock state? 回答1: Have your app listen our for the ACTION_SCREEN_OFF broadcast. More information here. public class ScreenReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { //screen locked } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) { //screen unlocked } } } You might also want to receive information of

Android MMS Monitoring

ぃ、小莉子 提交于 2019-12-12 09:28:30
问题 I have spent the last several hours trying to research this and understand it, however i've come up empty on every example I tried. Basically my app can send information via MMS to someone else, though the content is in a format that the native inbox doesn't display correctly. Sending the content works fine, however I need to be able to detect the incoming MMS message and open the content in my application to format it correctly. Are there any decent tutorials for this? Of the ones i've found

sendMultipartTextMessage ISms$Stub$Proxy.sendMultipartTextOnSubscription NullPointerException

可紊 提交于 2019-12-12 09:17:30
问题 Im getting nullpointerexception for the following code: I have SMS of more than 160 characters length, so im dividing them using divide() and then adding one sent PendingIntent. Sometimes this exception comes up. My mobile number and sms data are not null; String SENT = "SMS_SENT"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent( SENT), 0); // ---when the SMS has been sent--- BroadcastReceiver sentSMSStatusReciever = new BroadcastReceiver() { @Override public void

How to? Listen for Location Setting being turned ON (Android App)

ⅰ亾dé卋堺 提交于 2019-12-12 07:52:30
问题 So I've spent the past few weeks working on my Android App and looking into the best way of implementing what I need to do, but still can't quite get it right.. Any/all help is greatly appreciated, as I am still getting the hang of things.. Task: (Assuming the "Location"/GPS Setting is currently off), I need to have my App constantly be listening for the "Location" Setting to be turned ON.. At this point, simply start an Activity. Ideas: These are all the different ways I think it could