broadcastreceiver

android: sms broadcast receiver not getting full text for larger sms

不羁的心 提交于 2019-12-14 02:37:53
问题 It seems that if an SMS with some larger text comes, it is cut for some reason so not whole sms comes in, here is my code: public class SmsReceiver extends BroadcastReceiver { // vars here @Override public void onReceive(Context context, Intent intent) { // Get SMS map from Intent Bundle extras = intent.getExtras(); if (extras != null) { // Get received SMS array Object[] smsExtra = (Object[]) extras.get(SMS_EXTRA_NAME); String address = ""; String body = ""; for (int i = 0; i < smsExtra

How to unsubscribe to an RXjava call in a broadcast receiver

被刻印的时光 ゝ 提交于 2019-12-14 02:05:25
问题 I am using RXJava2 to send email within a broadcast receiver and I would like to know when I should unsubscribe to the event. The code is basically: getSmsMmsObservable() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .doOnError(throwable -> Timber.e(throwable, "Error sending mail.")) .map(smsMmsAddress1 -> { smsMmsAddress = smsMmsAddress1; return doInBackgroundSendEmail(); }) .map(stringSingle -> { mMsgResponse = stringSingle; this.done = true; return deleteFile();

Read sms only for OTP

北战南征 提交于 2019-12-13 22:16:44
问题 In my android application i am implementing auto fill OTP from SMS, I learnt from this link http://androiddhina.blogspot.in/2015/06/reading-incoming-message-automatically-to-verify-OTP.html My doubt is BroadcastReceiver reads every sms received by the user, can we stop this? I need to read sms at a particular time Example: only after user clicks the send OTP button after that I should stop reading sms. Please help me how to start and stop the BroadcastReceiver for particular period of time.

Perform long running operations when receiving SMS on API < 21

戏子无情 提交于 2019-12-13 20:24:11
问题 I'm building an app that will listen for incoming SMS messages, perform some potentially long running operations and send back a reply if some conditions are met. I've got the listening part working using a BroadcastReceiver , but I'm not sure how/where to perform the potentially long running operations. The Android Developer Documentation states that After onReceive(), the system can kill the process at any time to reclaim memory, and in doing so, it terminates the spawned thread running in

Starting the broadcast receiver when ever new sms arrives

你说的曾经没有我的故事 提交于 2019-12-13 19:20:00
问题 I have created a remote service which , is calling a broadcast receiver which in turn call the alarm manager for triggering the alarm , but i want to trigger the receiver through the rempte service when ever a new message arrives The piece of code is as follows: @Override public IBinder onBind(Intent arg0) { Log.d(getClass().getSimpleName(), "onBind()"); return myRemoteServiceStub; } private IMyRemoteService.Stub myRemoteServiceStub = new IMyRemoteService.Stub() { public int getCounter()

Android BroadcastReceiver and Activity.onPause()

怎甘沉沦 提交于 2019-12-13 17:56:59
问题 The documentation for BroadcastReceiver says: If registering a receiver in your Activity.onResume() implementation, you should unregister it in Activity.onPause(). (You won't receive intents when paused, and this will cut down on unnecessary system overhead). I made an example of Activity A1 that has an inner BroadcastReceiver that updates A1 interface when a Service S1 makes a sendBroadcast. S1 spends around 8 seconds to finish. When running A1 and hitting the home button for making A1 call

Broadcast Receiver listening to text selection

牧云@^-^@ 提交于 2019-12-13 16:41:58
问题 Is it possible to define a broadcast receiver that listens for text selection made on any application 回答1: There is no broadcast intent generated on text selection, so what you try to do is impossible. If there are specific apps that you'd like to provide them with external functionality, than you can contact the developers and ask them to explicitly broadcast an intent that you can receive and respond to. Hope that helps.. 来源: https://stackoverflow.com/questions/12145139/broadcast-receiver

How to disable the broadcast Receiver to stop receiving the incoming calls?

孤街醉人 提交于 2019-12-13 16:25:52
问题 I am facing the issue in disable the broadcast receiver. The broadcast receiver receives the incoming and outgoing calls . In my case when switch is in on the receiver should receive the data when the switch is in off the receiver should stop receiving the data. switches.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { // sharedPreferences = getApplicationContext()

Broadcast Receiver not receiving ACTION_BOOT_COMPLETED

别来无恙 提交于 2019-12-13 15:21:17
问题 I'm trying to do a basic BroadcastReceiver that can receive the Action_BOOT_COMPLETED. Whenever I run this in the emulator, it doesn't seem like the code from the BroadcastReceiver code. Manifest as follows: <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".BootAtStartupActivity" android:label="@string/app_name" >

Not found activity to handle intent?

你离开我真会死。 提交于 2019-12-13 14:25:19
问题 I am writing a program where the main activity in my app should be invoked when a particular SMS arrives on the phone. I have already registered a BroadcastReceiver and the intent to invoke the activity is in the onReceive() method. The problem is, everytime I send this particular SMS, I get a Force close. Reading the logcat, I see the following NullPoint Exception: 10- 20 02:07:16.558: E/AndroidRuntime(1200): java.lang.RuntimeException: Unable to start receiver edu.example.prankssms3