broadcastreceiver

Passing parameters to the BroadcastReceiver

对着背影说爱祢 提交于 2019-12-04 07:14:00
I'm trying to pass an int value from my Service to the CallReceiver class, unfortunately the CallReceiver.value always equals 0, even after set with another value. When I'm trying to pass it as a parameter to the constructor situation is exactly the same, and so with the setter methods called from service. Is there really no way to pass there any data? Service: SharedPreferences settings = getSharedPreferences("SETTINGS", 0); int value = settings.getInt("value1", 0); // here the correct value is present, not 0. CallReceiver mCallReceiver = new CallReceiver(); CallReceiver.value = value;

Android Widget Click and Broadcast Receiver Not Working

非 Y 不嫁゛ 提交于 2019-12-04 07:13:05
The below code should describe an app where once the widget button is clicked, it sends off an intent that should be received by TestReceiver. However, in running my below code, the onReceive of TestReceiver is never called. Could someone let me know what I'm doing wrong? Widget code public class Widget extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int N = appWidgetIds.length; // Perform this loop procedure for each App Widget that belongs to this provider for (int i=0; i<N; i++) { int appWidgetId = appWidgetIds

Android: ACTION_BATTERY_LOW not triggered in emulator. Receiver registered in code, not manifest

喜你入骨 提交于 2019-12-04 06:18:54
I have seen posts where it was mentioned registerReceiver has to be called (not defined in manifest) to receive ACTION_BATTERY_LOW intent. public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { //.... registerReceiver(new BatteryLevelReceiver(), new IntentFilter( Intent.ACTION_BATTERY_LOW)); } // ....... } BroadcastReceiver public class BatteryLevelReceiver extends BroadcastReceiver { private static final String TAG = BatteryLevelReceiver.class.getSimpleName(); @Override public void onReceive(Context context, Intent intent) { Log.d(TAG,

do I need a wake lock in my broadcastreceiver if I'm not starting a service or an activity?

心不动则不痛 提交于 2019-12-04 05:51:33
I have a broadcastreceiver called by an Alarm (scheduled with AlarmManager). In this receiver I'm only querying a register from the database, and launching a notification. I readed that a wake lock is needed when a service or an activity is started from a broadcast receiver, but, do I need a wake lock if I only want to show a notificacion (in the notification panel)? In this receiver I'm only querying a register from the database, and launching a notification. Do not do database I/O on the main application thread. I readed that a wake lock is needed when a service or an activity is started

Getting (not%20set) for UTM parameters with Install Referrer- Android

旧城冷巷雨未停 提交于 2019-12-04 05:22:42
I am using my custom broadcast receiver as follows to track UTM parameters. <receiver android:name=".services.CustomInstallListener" android:exported="true"> <intent-filter> <action android:name="com.android.vending.INSTALL_REFERRER" /> </intent-filter> </receiver> public class CustomInstallListener extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.hasExtra("referrer")) { String data = intent.getStringExtra("referrer"); String referrers[] = data.split("&"); for (String referrerValue : referrers) { String keyValue[] = referrerValue.split("=

Broadcast receiver is triggered automatically on start

梦想与她 提交于 2019-12-04 04:48:50
问题 I have a registered BroadcastReceiver in my main activity. Activity sends a sticky in one of the tabs to trigger the broadcast receiver ( TabActivity application). Everything works fine, but when I restart the app the sticky is sent automatically (not triggered by user) and view is opened. My question is: how is that possible? Did I misunderstand something? And how can I fix that? MainActivity: OnCreate: registerReceiver(openOutgoingCall, new IntentFilter("OPENOUTGOINGCALL"));

Android - get a reference to a BroadcastReceiver defined in Manifest

亡梦爱人 提交于 2019-12-04 04:11:34
问题 Is there any way how to get a reference for a BroadcastReceiver defined in Manifest.xml from code? In my case, we are using a BroadcastReceiver that needs to be included in the Manifest.xml. However it has functionality I would like to reuse from within our code. So instead of creating another similar BroadcastReceiver and instantiating it from the code I would like to obtain a reference to the existing one. Additional information: My goal is to subscribe to an event on my BroadcastReceiver

are multiple broadcast receivers legal in android?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 04:09:52
Is this true? Only one BroadcastReceiver class can be specified per application. Should you need to incorporate two or more BroadcastReceivers from different SDKs, you will need to create your own BroadcastReceiver class that will receive all broadcasts and call the appropriate BroadcastReceivers for each type of Broadcast. http://code.google.com/apis/analytics/docs/mobile/android.html#google-play-tracking There is no mention of this in the manifest documentation for <receiver/> http://developer.android.com/guide/topics/manifest/receiver-element.html The quoted passage is from the

android: validate the identity of intent sender

孤街浪徒 提交于 2019-12-04 04:07:15
I work in a company that produces several apps, not all those apps have the same signature or more like it we have at least 5-6 apps certificates for the time being. We tried to create a mechanism in which all the companie's apps on the same device share the same is, For example if user installed from the market App A and no app installed, a new ID will be generated, if now he installs App A, app B should have the same id as App A(id is just a generated UUID type #4) etc... We are using broadcast at the moment and only apps with our permission can receive that broadcast and send back the id

Passing String data between Android applications

不想你离开。 提交于 2019-12-04 04:02:06
问题 What is the best way to pass simple data such as a String between applications? The String is some field that is known in the sender app and is needed by the receiver app. I looked into storing it in a MODE_WORLD_READABLE SharedPreferences, but I won't necessarily know the package name (this would exist in a library), the value can be set by various apps, so it'd be difficult to look up. I was thinking have both apps contain BroadcastReceivers. When the receiver app is opened, it sends a