broadcastreceiver

ProximityAlert with a BroadcastReceiver not working

浪子不回头ぞ 提交于 2019-12-02 07:39:28
I am new to Android and have a problem with adding ProximityAlert with a BroadcastReceiver. I know that this topic has been taken up earlier as well but I am trying to add proximity alert to different locations and I am not sure if what I am trying to do is quite achievable this way or I am just doing it wrong. Problem : I have tried to implement the code for adding ProximityAlert with a BroadcastReceiver, but its not working some how. Below is the snippet from my code (posted below) requesting all to please have a look and help me out with it. I have this userLocations list. I am adding

android.intent.action.CAMERA_BUTTON not broadcasting on Desire Z (Froyo)?

拈花ヽ惹草 提交于 2019-12-02 07:30:41
I have hard time intercepting HW camera button on Desire Z (Froyo). I wrote a sample that runs fine on G1 (1.6) but not on aforementioned phone. AndroidManifest.xml <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="net.company" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="4" /> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".CameraReceiverTestActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android

Why does ACTION_MEDIA_BUTTON fail to process events?

混江龙づ霸主 提交于 2019-12-02 07:20:39
问题 Following the training section on how to use hardware playback control keys to control audio playback, I create a listener class: public class RemoteControlReceiver extends BroadcastReceiver { @Override public void onReceive(Context arg0, Intent intent) { if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())) { KeyEvent event = (KeyEvent)intent.getParcelableExtra(Intent.EXTRA_KEY_EVENT); Log.e(TAG, "ACTION_MEDIA_BUTTON"); int keycode = event.getKeyCode(); switch (keycode) { case KeyEvent

alarm manager not working while updating interval time

拥有回忆 提交于 2019-12-02 06:34:26
问题 after reading all the QA i didnt get any proper solution. I have 2 problems 1. Alarm fires twice even if i register my receiver only in manifest.(not by code) 2. when i update interval time of alarm it gets fires randomly here is my method for set alarm public void AlarmCall(int min) { Intent intent = new Intent(context, AlarmReceiver.class); PendingIntent pintent = PendingIntent.getBroadcast(context,0 , intent, 0); alarm = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);

Android broadcastreceiver not triggering when app is not running

前提是你 提交于 2019-12-02 06:31:23
Following this guide https://developer.android.com/training/monitoring-device-state/battery-monitoring.html I made a receiver that should log battery info to a file every time charger is plugged or unplugged. The activity reads the content of this file and displays it on screen. This is supposed to work always regardless of the app running, but it doesn't. It only registers if the app is open/in memory, when I clear the memory or reboot it stops working. Manifest: <receiver android:name=".Receiver"> <intent-filter> <action android:name="android.intent.action.ACTION_POWER_CONNECTED"/> <action

Service based Android application on Google Play Store

流过昼夜 提交于 2019-12-02 06:25:58
I'm developing an application which will consists only of a few services and no activities (i.e. no UI) Basically I want to have 2 to 3 services to be running in the background right from when user installs the application on his/her device. I have a few questions over this: How will my services start after application installation? My BroadcastReceiver should be listening to which event? How can I package my application to deploy it application on Googly Play Store? You can't do that on newer Androids. Android specifically requires user interaction before starting up services - the user will

unregister anonymous BroadCastReceiver

南楼画角 提交于 2019-12-02 06:00:46
问题 I am doing SMS sending functionality. I am registering using anonymous broadcast receiver. Now I get Exception to do unregister. Below is my code: public class SMSUtility { public static void sendSMS(final Context context, String phoneNumber, String message) { MobiculeLogger.showInfoLog("SMS UTILITY", "Inside sendSMS"); String SENT = "SMS_SENT"; String DELIVERED = "SMS_DELIVERED"; PendingIntent sentPI = PendingIntent.getBroadcast(context, 0, new Intent(SENT), 0); PendingIntent deliveredPI =

Pass a value from activity to broadcastreceiver and start a service from the broadcast receiver

谁说我不能喝 提交于 2019-12-02 05:46:39
问题 I have an activity. It contains a button whose text changes dynamically. I would like to pass this text to my broadcast receiver which receives the sms. Now my broadcast receiver should receive the text and based on the text it should start or stop a service. How to do this? 回答1: if your BroadcastReceiver is defined in a separate class file, then you may simply broadcast the value to that receiver. Once the value is received, do the magic for service by using receiver's context Update: in

Android activity not getting broadcast from local service

 ̄綄美尐妖づ 提交于 2019-12-02 05:41:04
问题 From the examples this looked straightforward. Maybe you can show me what I did wrong. I can't get an activity to receive a broadcast sent from a local service. I have Activity1 that start Service1: startService(new Intent(Activity1.this, Service1.class)); Activity1 then starts Activity2: startActivity(new Intent(Activity1.this, Activity2.class)); Service1, a local service, listens for downloads: protected final BroadcastReceiver service2DownloadBroadcastReceiver = new BroadcastReceiver() {

Can an ACTION_USER_PRESENT BroadcastReceiver not be registered in the manifest?

霸气de小男生 提交于 2019-12-02 05:26:30
问题 I see that multiple broadcasts (ACTION_TIME_TICK, for example) cannot be registered in the manifest, the must be explicitly registered via Context.registerReceiver() . I am having trouble with the ACTION_USER_PRESENT broadcast intent. Specifically, I test on the emulator and my application keeps force closing with the error: 08-30 09:44:23.397: ERROR/AndroidRuntime(290): java.lang.RuntimeException: Unable to start receiver me.turnerha.RegisterListeners: java.lang.IllegalArgumentException: