broadcastreceiver

Monitor Currently Running Application

一个人想着一个人 提交于 2019-12-02 17:56:16
问题 I am encountering a problem that i can't not solve for the moment. The purpose of the code is to monitor which applications are running at current moment. I used the following code and logged the resulting package name, it worked. ActivityManager am = (ActivityManager) context.getSystemService(Activity.ACTIVITY_SERVICE); String packageName = am.getRunningTasks(1).get(0).topActivity.getPackageName(); Log.i("TTWYMonitor", packageName); But I use that code in a BroadcastReceiver , nothing

LocalBroadcastManager vs Context.registerReceiver(), Context.sendBroadcast(Intent), and Context.unregisterReceiver() are they same?

喜夏-厌秋 提交于 2019-12-02 17:40:17
I was using Context.registerReceiver(), Context.sendBroadcast(Intent) , and Context.unregisterReceiver() but when I saw the class LocalBroadcastManager , it has registerReceiver(), sendBroadcast(Intent) , and unregisterReceiver() like in Context . I'm confused. When should I use the LocalBroadcastManager ? are they same in Context ? Regards, Thanks... LocalBroadcastManager is as its name says, an implementation of the broadcast methods that are only available to your app. This has some benefits, with the biggest being safety, one less hole to watch out for. In terms of implementation, there

How to debug BOOT_COMPLETE broadcast receiver's “Force Close” crashes?

两盒软妹~` 提交于 2019-12-02 17:22:00
Since the phone restarts and thus gets disconnected from the Eclipse debugger/LogCat while it's booting up, how do I see where my boot complete broadcast receiver is crashing? I am performing some actions in the onReceive() of my public class BootCompleteReceiver extends BroadcastReceiver { ... } This is crashing and popping up a force close dialog when the phone boots. How do I debug this and see where the problem is? The question holds true for debugging any BOOT_COMPLETE broadcast receivers. Thanks! EDIT Yes, we can see the system logs in LogCat as the phone is booting up but my app Log.d

How can i call a BroadCastReceiver inside a Service with a local Notification -Xamarin.Android

三世轮回 提交于 2019-12-02 16:56:02
问题 Am working on an Alarm Application which works on a scheduled time , and i want it to work when the Users have launched the App or not (Both). Meaning the Application will notify like Usual Alarms Now i came to the point when i wanted to call a broadcastReceiver inside a Service so that , it performs that action. What i noticed : 1.When i use a Broadcast , the Alarm Notification comes only when i have opened the App. 2.When i use a Service the Alarm comes only when am outside the Application

How to make app lock app in android?

半城伤御伤魂 提交于 2019-12-02 16:32:17
I have to develop an app locker for Android where the user can block apps and other users can not access these apps without an access key. I have installed an app but I don't know how to lock this app. Please suggest me something. This is not how stack overflow works. You can not ask a complete solution without even trying anything. For the most basic version of your app, you need to perform three functions. Get a list of all the installed apps on device and show them in a ListView with check box. If the user checks any app, add the app to a different list say BlockedAppsList(which will be the

Why BroadcastReceiver is not running in the background?

陌路散爱 提交于 2019-12-02 16:26:35
问题 In one application (App1) I am broadcasting a message. This code below is correct -> the broadcast is detected if I try to get Broadcast in the same project. sendBroadcast(new Intent("com.example.MESSAGE_INTENT").putExtra("MESSAGE", ((EditText) findViewById(R.id.textField)).getText())); I created App2 which has a BroadcastReceiver which waits for the broadcasted Intent but the method onReceive is never invoked. How to change the BroadcastReceiver app to make the service work in background all

Android: How to get the installed App information using Broadcast receiver

主宰稳场 提交于 2019-12-02 15:39:40
问题 I am new to android. I am using a Broadcast receiver which listens when a app is installed or removed.. When a app is installed or removed my Broadcast Receivers's onReceive(context,intent) will be called.. Now i need to get the info about the application installed or removed (Mainly the package name).. Plz help 回答1: All the information you want is in the Intent extras. Look at How to find the package name which has been uninstalled when using Intent.ACTION_PACKAGE_REMOVED 回答2: You can try

BroadcastReceiver doesn't get called when using it for push notification

China☆狼群 提交于 2019-12-02 15:37:12
问题 I am trying to use GCM push notification of Android in a plugin. I am getting the valid registration ID from Google server. But when I send any data from server, the BroadcastReceiver doesn't get called at all. I think the issue is with the permissions in manifest, here's the portion of manifest that I am using - <receiver android:name="com.creator.gcm.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <action android:name="com.google.android

Do I need to acquire wake lock when invoking a BroadcastReceiver

不羁岁月 提交于 2019-12-02 15:21:45
问题 In the book Pro Android 4 By Satya Komatineni , Dave MacLean I've found: Android acquires a partial wake lock when invoking a broadcast service and releases it when it returns from the service in the main thread Does it mean that the Android OS ensures that the device will wake up for the time of going through onReceive of BroadcastReceiver ? In my case the BroadcastReceiver should get an intent from Google Play Services (GoogleLocationServices and to be precise Geofences api). Where is it

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

﹥>﹥吖頭↗ 提交于 2019-12-02 14:14:55
问题 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="