broadcastreceiver

KeyEvent.ACTION_UP fired TWICE for ACTION_MEDIA_BUTTON

旧街凉风 提交于 2019-12-12 07:44:57
问题 I have this broadcast receiver for ACTION_MEDIA_BUTTON which actually works for both Android 2.x and Android 4.1, but for some strange reason, on Android 2.x (only) , I get each even twice (for a single click on the pause button, of course): public class RemoteControlReceiver extends BroadcastReceiver { private static long prevEventTime = 0; @Override public void onReceive(Context ctx, Intent intent) { if (Intent.ACTION_MEDIA_BUTTON.equals(intent.getAction())) { KeyEvent event = (KeyEvent

how to make an incoming call from our application [duplicate]

人盡茶涼 提交于 2019-12-12 07:05:15
问题 This question already has answers here : How to send fake call broadcast on android (2 answers) Closed 5 years ago . i am trying to make an incoming call from a number given by me. in short i want to make fake incoming call . as i am new so i am not understanding how to complete this task. i have created incomingCallReceiver class where i am listening state of phone call. inside my activity class i am calling incomingCallReceiver class. this is my IncommingCallReceiver public class

Android - How to send data to another app without bringing it to the foreground?

你说的曾经没有我的故事 提交于 2019-12-12 06:44:46
问题 We are planning to link our app with another person's app, and we would like to know, how would we be able to in Android for our app to send data to that other person's app without bringing the other app to the foreground? Would this solution work?: How to Send BroadCast from one app to another app I would like to know for sure before I proceed. 回答1: Yes. Send your data using a broadcast Intent and implement a BroadcastReceiver on the receiving app. This will not automatically bring the

Android use Broadcast Receivers to send value

人盡茶涼 提交于 2019-12-12 06:24:46
问题 I have this AccessibilityService class: public class USSDService extends AccessibilityService { public static String TAG = "USSDService"; public String responsee=""; @Override public void onAccessibilityEvent(AccessibilityEvent event) { Log.d(TAG, "onAccessibilityEvent"); String text = event.getText().toString(); if (event.getClassName().equals("android.app.AlertDialog")) { performGlobalAction(GLOBAL_ACTION_BACK); Log.d(TAG, text); Intent intent = new Intent("message"); intent.putExtra("value

Broadcast receiver not working in some cases

最后都变了- 提交于 2019-12-12 06:17:37
问题 So i have this receiver in my Fragment.class private BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(WeekplanHepler.ACTION_SERVICE_BINDED) && getUpdateService() != null) { getCounts(); } if (intent.getAction().equals(Helper.UpdateCounts)) { HashMap<String, Integer> counts = (HashMap<String, Integer>) intent.getSerializableExtra(Helper.PARAM_LIST_COUNTS); // Updating counts } } }; For

BroadCastReceiver Android

我与影子孤独终老i 提交于 2019-12-12 05:38:33
问题 I'm realy newbie in android, and i'm having dificult with broadcastreceiver in my project. I've created uses-permission and the receiver in AndroidManifest.xml, created the class but it not passing on the logcat message. MY RECEIVER CLASS package com.polifrete.polifreteFunctions; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.util.Log; public class MyReceiver extends BroadcastReceiver { @Override public void onReceive

Alarm Manager isn't repeating after reboot

白昼怎懂夜的黑 提交于 2019-12-12 05:34:24
问题 I have problem with Alarm Manager. I create alarm manager which repeat displaying toast every 15 seconds. After rebooting my device, toast is visible, but only once. I want to repeat it again every 15 seconds even after reboot. What can I add to solve this? Is this possible? Here is my code (class AlarmReceiver extends BroadcastReceiver): @Override public void onReceive(Context context, Intent intent) { PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);

Install APK EXTRA_RETURN_RESULT from IntentService

风流意气都作罢 提交于 2019-12-12 05:27:38
问题 I'm trying to get the results from an APK update, to a Service. Actually I'm using an IntentService, that is running in the background. My install is done by the Service creating a PendingIntent for Notification and then it's received in a BroadcastReceiver which calls the following: apkUri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".share", toInstall); Intent installIntent = new Intent(Intent.ACTION_INSTALL_PACKAGE); installIntent.setData(apkUri); installIntent

Accessing main activity in Broadcast Reciever without using intent

筅森魡賤 提交于 2019-12-12 05:13:20
问题 I am stuck in a problem. I have a broadcast receiver that calls the method of class takes in context and main activity reference in constructor. I dont know how to access main activity in broadcast receiver.Here is my code: public void onReceive(@NonNull Context context, @NonNull Intent intent) { if (context == null) { throw new IllegalArgumentException(); } ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cm

BroadcastReceiver fires after the activity is already created

一曲冷凌霜 提交于 2019-12-12 04:59:44
问题 I want to use a BroadcastReceiver to get permission to communicate with a USB device. I am trying to implement it the same way it is done on android website http://developer.android.com/guide/topics/usb/host.html It all works, kind of. But the broadcastReceiver is fireing only after the main activity is created. Which means I am able to communicate with the device only after close the app and open it again (when I don't unregister the broadcastReceiver, when I do I can't communicate at all).