broadcastreceiver

android.intent.action.SCREEN_ON doesn't work as a receiver intent filter

╄→гoц情女王★ 提交于 2019-12-17 06:47:04
问题 I'm trying to get a BroadcastReceiver invoked when the screen is turned on. In my AndroidManifest.xml I have specified : <receiver android:name="IntentReceiver"> <intent-filter> <action android:name="android.intent.action.SCREEN_ON"></action> </intent-filter> </receiver> However it seems the receiver is never invoked (breakpoints don't fire, log statements ignored). I've swapped out SCREEN_ON for BOOT_COMPLETED for a test, and this does get invoked. This is in a 1.6 (SDK level 4) project. A

How to monitor SIM state change

一笑奈何 提交于 2019-12-17 04:53:26
问题 I'd like to be able to do some stuff when the SIM state change, i.e. play a sound when SIM PIN is required, but I think there are no Broadcast events that can be intercepted by a broadcast receiver for this... registering for android.intent.action .PHONE_STATE does only tell you when the CALL-STATE changes.. An alternative can be starting a service that registers a PhoneStateListener and reacts upon a LISTEN_SERVICE_STATE (when the state is OUT-OF-STATE it can get the SIM state from the

How to monitor SIM state change

蓝咒 提交于 2019-12-17 04:53:04
问题 I'd like to be able to do some stuff when the SIM state change, i.e. play a sound when SIM PIN is required, but I think there are no Broadcast events that can be intercepted by a broadcast receiver for this... registering for android.intent.action .PHONE_STATE does only tell you when the CALL-STATE changes.. An alternative can be starting a service that registers a PhoneStateListener and reacts upon a LISTEN_SERVICE_STATE (when the state is OUT-OF-STATE it can get the SIM state from the

How to check if Receiver is registered in Android?

旧巷老猫 提交于 2019-12-17 04:44:16
问题 I need to check if my registered receiver is still registered if not how do i check it any methods? 回答1: I am not sure the API provides directly an API, if you consider this thread: I was wondering the same thing. In my case I have a BroadcastReceiver implementation that calls Context#unregisterReceiver(BroadcastReceiver) passing itself as the argument after handling the Intent that it receives. There is a small chance that the receiver's onReceive(Context, Intent) method is called more than

How to Send BroadCast from one app to another app

走远了吗. 提交于 2019-12-17 04:29:21
问题 I have App A and App B. In App A I want to send broadcast to App B. This is the code for App A: final Intent intent = new Intent(); intent.setAction("com.pkg.perform.Ruby"); intent.putExtra("KeyName", "code1id"); intent.setComponent(new ComponentName("com.pkg.AppB", "com.pkg.AppB.MainActivity")); sendBroadcast(intent); And in App B - In MainActivity , I have MyBroadCastReceiver Class. public class MainActivity extends Activity { private MyBroadcastReceiver MyReceiver; @Override protected void

How to block a mobile number call and message receiving in android application development?

半世苍凉 提交于 2019-12-17 04:15:02
问题 I would like to implement an application for block a mobile number for receiving or sending calls and messages. In my application I am entering mobile number at EditText box then I am clicking a button for block the mobile number which has entered by the user. I have implemented an activity class as follows: public class BlockNumberActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Tracking user location

天涯浪子 提交于 2019-12-14 04:21:36
问题 Problem: The user can choose how long and when start to track your locaton (Like today from 08:00 to 16:00). So during this interval my application will listen for the location every 5 minutes (this time can be changed, it's a user's preference). What I'm thinking: Making a service to be running and listenning for coming of the GPS or network locations during the time interval definned by the user. Problem: The service can be removed for running a long time? I need to registers listeners to

How to use SUPPLICANT_STATE_CHANGED_ACTION WiFi BroadcastReceiver - android

房东的猫 提交于 2019-12-14 03:49:43
问题 I want to show the connection process on the screen when my device is connecting to the wifi network. SUPPLICANT_STATE_CHANGED_ACTION is provided by WifiManager but i don't know how to use it. Can anyone help me please? 回答1: I don't know of a callback method that lets you know when the wifi status has changed. I polled the information using a Handler running in the background. Add the handler to your class. private WifiStatusHandler wifiStatusHandler = new WifiStatusHandler(); Start it by

I can't start an activity from a broadcast receiver

余生长醉 提交于 2019-12-14 03:13:43
问题 I have a broadcast receiver from which, when it receives an intent, I would like to start/resume an activity. Up to point to start the activity everything works fine, I get the intent etc. But I cannot start my activity. Here is my android manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.imgzine.testing" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" /> <uses-permission android

Listener for media button (headset-hook) using service without Activity

笑着哭i 提交于 2019-12-14 02:39:59
问题 How can I make service listen for media button (headset-hook) in android device . I try to do that using this code but did not work. Can you help me. Service code: public class RLservice extends IntentService { private Handler handler; public RLservice() { super("my service"); // TODO Auto-generated constructor stub } @Override public int onStartCommand(Intent intent, int flags, int startId) { handler = new Handler(); return super.onStartCommand(intent, flags, startId); } @Override protected