android-broadcast

Detect Lock Screen Incorrect Password by user in Android

流过昼夜 提交于 2019-11-28 20:56:16
I am building a security app and I need to know if the user is giving incorrect password . Suppose user phone is locked by pattern lock system , and unfortunately user has forgotten the pattern password.When user give wrong pattern 5 time, there will be a penalty for 30 sec . I need to catch that penalty event . In my app, i have to do some task (for the safety of user) when this even come . Please help me, You can set up a DeviceAdminReceiver that will be notified about failed password attempts, as well as a successful password attempt that occurred after a failed attempt. This is covered in

how to check screen on/off status in onStop()?

↘锁芯ラ 提交于 2019-11-28 17:33:17
as mentioned here , when the screen goes off, the onStop() of current Activity will be called. I need to check the screen on/off status when the onStop() of my Activity is called. so I have registered a BroadcastReceiver for these actions( ACTION_SCREEN_ON AND ACTION_SCREEN_OFF ) to record the current on/off status(and they work properly, I have logged!). but when I turn off the screen and check the on/off status in the onStop , it says the screen is on. why? I think the receiver must receive the ACTION_SCREEN_OFF before onStop is called so what's wrong? You can try to use PowerManager system

how to start my application when ever mobile restart or turn on

点点圈 提交于 2019-11-28 14:39:45
How do i set my application as startup application, so when ever mobile restarts or turned ON, my application starts. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.installedapps22" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="8" /> <application android:icon="@drawable/cherry_icon" android:label="@string/app_name"> <activity android:name=".MainActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action

Android - Unable to receive local broadcast in my activity from service

可紊 提交于 2019-11-28 14:32:40
I have my main activity that start a service (Location service) and I want that service to broadcast the new location each time a new location is found. Thanks to the log I know the service is working and I have new locations every seconds or so, but I never get the broadcast. MainActivity.java public class MainActivity extends Activity { private static final String TAG = "mainActivity"; private CMBroadcastReceiver mMessageReceiver = new CMBroadcastReceiver(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { // Start Service

Android Broadcast Receiver vs Service [duplicate]

末鹿安然 提交于 2019-11-28 13:56:55
问题 This question already has an answer here: BroadcastReceiver vs Service 2 answers I am trying to clarify the difference between a Broadcast Receiver and Service in android. I understand that an activity can start a service by calling startService with an intent. A broadcast receiver can be registered in code or the manifest and can be called with sendBroadcast . When would you use one vs the other? I understand that multiple broadcast receiver's can be listening for the same intent and this is

BOOT_COMPLETED intent not received on all devices

孤街浪徒 提交于 2019-11-28 09:54:07
问题 I have created an application that receives BOOT_COMPLETED within a receiver using the following filter: <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> I receive this on one device but I have another device that does not receive this despite using the same APK. What device-specific issues could prevent a particular device from receiving this intent? Is there any way to test for this and create a remedy? 回答1: Make sure that you are doing a real full reboot. Some

BroadcastReceiver not working when app is not running

这一生的挚爱 提交于 2019-11-28 07:57:14
问题 In my manifest file I have declared the receiver. (as follows) <receiver android:name=".OnAlarmReceive" /> however, once I shut down my application, I am not able to get the alarms and the notifications. Apparently, a call to the OnReceive in my Broadcast receiver is never made. public class OnAlarmReceive extends BroadcastReceiver { @Override public void onReceive(Context context, Intent arg1) { //various stuff } } Inside the MainActivity, my alarm manager class is as the follows.

Communicate between different instances of same fragment

限于喜欢 提交于 2019-11-28 07:53:41
问题 The problem as follows. Let us have 3 tabs with fragments: Tab 1 (Fragment A). Needs to send data to Tab 2. Tab 2 (Fragment B). Needs to receive data from Tab 1. Tab 3 (Fragment B). Already contains data. As you see Tab 3 and Tab 2 contain the same Fragment but different instances. How do I send data (not via arguments) to exactly Tab 2? What I've tried: Set the unique ID for Fragment B via arguments when they were created. Register same Local Broadcast Receiver for both instances of Fragment

Listen to incoming Whatsapp messages/notifications

喜夏-厌秋 提交于 2019-11-28 03:50:30
I'm working on a notification based app, for which I need to listen to incoming notifications. I've been able to listen to incoming calls, SMS, mail etc. I have no clue how to listen for pings or messages from friends on Whatsapp via code. Can this actually be done? If so, how? Can Accessibility Service be used for this, using Package Name as "com.whatsapp"? I was able to do this using Accessibility Service . Using this, you can listen to all notification on the notification bar. I listened to application-specification by adding the package name to the Accessibility Service service info ,

Fatal Exception: android.app.RemoteServiceException: can't deliver broadcast at android.os.Handler.dispatchMessage

佐手、 提交于 2019-11-28 00:43:01
I am using broadcast messages on my android application (From io.socket I am sending broadcast messages to my Activity page). On some devices Samsung SM-G950F and SM-A520F I got an error " Fatal Exception: android.app.RemoteServiceException: can't deliver broadcast ". I got this error on Fabric crashlytics also I was not able to reproduce this issue. Here is the log I got from Fabric, Fatal Exception: android.app.RemoteServiceException: can't deliver broadcast at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1813) at android.os.Handler.dispatchMessage(Handler.java:102) at