broadcastreceiver

Broadcast Receiver is not registering in android oreo

╄→尐↘猪︶ㄣ 提交于 2019-12-11 09:42:36
问题 SmsBroadcastReceiver was not triggering when i received otp in oreo. I have explicitly registered my receiver in fragment instead of not only in manifest. public class MyFragment extends Fragment{ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { intentFilter = new IntentFilter(); intentFilter.addAction(Telephony.Sms.Intents.SMS_RECEIVED_ACTION); smsBroadcastReceiver = new SmsBroadcastReceiver(); getActivity().registerReceiver

Why cant I set TextView to display incoming call phone number?

ぐ巨炮叔叔 提交于 2019-12-11 09:09:00
问题 I have an app that replaces the standard incoming call screen with my own design. When someone calls, my custom screen pops up. This is good, but for some reason, my app fails to display the incoming phone number. The incoming phone number shows in LogCat, but when I try to set the TextView to that String, nothing shows. Here is the code that retrieves the incoming phone number: Bundle extras = intent.getExtras(); phoneNr = extras.getString("incoming_number"); Log.v(TAG, "phoneNr: " + phoneNr

Broadcast Receiver not calling Service while app was killed

拜拜、爱过 提交于 2019-12-11 08:47:20
问题 My target was Restarting the Service when app is in background or even killed from home page by sweeping. App & Service is working nice while app is in foreground and background but while I killed the app by force(sweeping out from home page), the Service stopped working. That's okay but I implemented a Broadcast Receiver to restart the Service but it seems like its (Broadcast Receiver) not even called itself or the Service while app was killed forcefully / sweeping from home page. My device

Large data transmission in Bluetooth Low Energy between HM10 with Arduino & Android BLE

廉价感情. 提交于 2019-12-11 08:37:15
问题 Have an issue receiving data from HM-10 Bluetooth Low Energy in my android App I did half the way. what I did is : sending data from the phone to the BLE and i succeeded now i want to receive data to my phone from the BLE. (Arduino) --> (HM-10 BLE) ->-->-BLE CONNECTION-->-->- (ANDROID APP) So I'm sending dummy data from Arduino but I cannot receive it in the app. here's the class that responsible to send data from Android to the BLE Module public class DeviceControlActivity extends Activity {

registerReceiver from IntentService doesn't hit BroadcastReceiver

白昼怎懂夜的黑 提交于 2019-12-11 08:00:35
问题 I've created an IntentService for downloading a file using Android's DownloadManager. Following is my Class: public class DownloadService extends IntentService { public DownloadService() { super("name"); } BroadcastReceiver onComplete = new BroadcastReceiver() { public void onReceive(Context ctxt, Intent intent) { function(); } }; @Override protected void onHandleIntent(Intent intent) { registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)); Utility.download

android: receive sms even if app is closed

为君一笑 提交于 2019-12-11 08:00:04
问题 I am writing an app, which should work even after the app is closed. Here is the code which I wrote to accept the incoming SMS. public class SMSReceiver extends BroadcastReceiver { private ResultReceiver receiver; private Context context; @Override public void onReceive(Context context, Intent intent) { this.context = context; // Parse the SMS. Bundle bundle = intent.getExtras(); SmsMessage[] msgs = null; String str = ""; if (bundle != null) { // Retrieve the SMS. Object[] pdus = (Object[])

Making this code work on boot

为君一笑 提交于 2019-12-11 07:59:26
问题 I have been stuck on this for weeks now...I can not get this to work. What I am trying to do is for my app to recognize when a user plugs in there earphones/headphones into the phone, and when they do, for it to show a notification icon. Here is my class. I have added the public class ItudeMobileBroadcastReceiver extends BroadcastReceiver { int NOTIFICATION_ID = 1234567890; NotificationManager mNotificationManager; @Override public void onReceive(Context context, Intent intent) { /* Only

Activity -> AsyncTask -> BroadcastReceiver -> Update UI

一笑奈何 提交于 2019-12-11 07:54:18
问题 I am starting an AsyncTask from an Activity . When, the AsyncTask completes its execution I need to send a broadcast which needs to call Activity method to update the UI. Any good approach to achieve this. 回答1: Yes. If the AsyncTask is an inner class of your Activity then it has access to any member variables and your Activity methods. If it isn't then you can simply pass variables to its constructor or even a reference to the Activity to call Activity methods from onPostExecute() . Without

How to register a BroadcastReceiver() inside a thread

强颜欢笑 提交于 2019-12-11 07:49:52
问题 I have a soundrecorder android thread and i need to know if mic/headset is connected or not while recording,so i need to use a BroadcastReceiver() inside the thread.how can i register that? this.registerReceiver() wont work because it only works inside activities. If using broadcasereceivers inside a thread is not a good idea,so whats the solution? here is the code which would work inside an activity and wont work inside a thread: headsetReceiver = new BroadcastReceiver() { @Override public

Passing Parameters from An Activity to BroadcastReceiver

不打扰是莪最后的温柔 提交于 2019-12-11 07:43:49
问题 Hey I have been trying to pass an array of string from my activity to broadcast receiver but it always give me null at broadcast receive i have tried it in 2-3 ways. // Code in Receiver String stringText= intent.getExtras().getString("string_text"); //Code in Activity Intent i = new Intent("android.intent.action.PHONE_STATE"); i.putExtra("string_text", "abc"); sendBroadcast(i); but at receiver end stringText always come null. I have tried it in another way but no luck String text= (String