SMS broadcast receivers don’t’ work after phone restart

85 views
Skip to first unread message

Michael Ginzburg

unread,
Jan 14, 2018, 4:45:45 AM1/14/18
to Google App Engine

Hi,

 

We are trying to build our autoresponder app with the SDK 26 as a target version

 

We have 2 PhoneStateReceivers in our app. (see code below)

Also we are requesting

android.permission.READ_SMS

android.permission.READ_PHONE_STATE

Permissions

And user accept it

 

But after phone restart and before user unlock device (lock screen) both sms broadcast receivers don’t’ work

 

Could you please advise!!

 

Thanks you in advance

Michael

===========================

 

 

in AndroidManifest.xml

<receiver android:name="com.lemi.callsautoresponder.callreceiver.DynamicPhoneStateReceiver" android:directBootAware="true" android:enabled="true" android:exported="true" />

<receiver android:name="com.lemi.callsautoresponder.callreceiver.PhoneStateReceiver" android:directBootAware="true" android:enabled="true" android:exported="true">

          <intent-filter android:priority="2147483647">

              <action android:name="android.intent.action.PHONE_STATE"/>

              <action android:name="android.provider.Telephony.SMS_DELIVER"/>

              <action android:name="android.provider.Telephony.SMS_RECEIVED"/>

          </intent-filter>

          <intent-filter android:priority="2147483647">

              <action android:name="android.provider.Telephony.GSM_SMS_RECEIVED"/>

              <category android:name="android.intent.category.DEFAULT"/>

          </intent-filter>

          <intent-filter android:priority="2147483647">                

              <action android:name="android.provider.Telephony.WAP_PUSH_RECEIVED"/>

              <data android:mimeType="application/vnd.wap.sic"/>

          </intent-filter>       

</receiver>

 

 

in Application.java

 

public void registerPhoneStateReceiver() {

   Log.i(TAG, "register PhoneState receiver");

   _phoneReceiver = new DynamicPhoneStateReceiver();

   IntentFilter intentFilter1 = new IntentFilter();

   //intentFilter.addAction(PhoneStateReceiver.SMS_RECEIVED);

   intentFilter1.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);

   intentFilter1.addAction("android.intent.action.BOOT_COMPLETED");

   intentFilter1.setPriority(0x7fffffff);

   intentFilter1.addCategory("android.intent.category.DEFAULT");

   appContext.registerReceiver(_phoneReceiver, intentFilter1);

  

       IntentFilter intentFilter2 = new IntentFilter("android.provider.Telephony.SMS_RECEIVED");

       intentFilter2.setPriority(0x7fffffff);

       intentFilter2.addCategory("android.intent.category.DEFAULT");

       appContext.registerReceiver(_phoneReceiver, intentFilter2, "android.permission.BROADCAST_SMS", null);

      

       IntentFilter intentFilter3 = new IntentFilter("android.provider.Telephony.GSM_SMS_RECEIVED");

       intentFilter3.setPriority(0x7fffffff);

       intentFilter3.addCategory("android.intent.category.DEFAULT");

       appContext.registerReceiver(_phoneReceiver, intentFilter3, "android.permission.BROADCAST_SMS", null);

 

}

 

public class PhoneStateReceiver extends BroadcastReceiver {

 

  @Override

  public void onReceive(Context context, Intent intent) {

 

    Log.info(TAG, "received sms");

 

  }

}

 

public class DynamicPhoneStateReceiver extends BroadcastReceiver {

 

  @Override

  public void onReceive(Context context, Intent intent) {

 

    Log.info(TAG, "received sms");

 

  }

}

 

 

Yannick (Cloud Platform Support)

unread,
Jan 14, 2018, 1:42:13 PM1/14/18
to Google App Engine
Hello Michael, this forum is about App Engine, not the Android SDK. As such you are unlikely to get help regarding this question here.

You should instead check out Android's Developer Support Resources as well as community sites such as the XDA Forums and Stack Overflow.

LeMi Apps

unread,
Jan 15, 2018, 2:48:25 AM1/15/18
to 'Yannick (Cloud Platform Support)' via Google App Engine

Thank you for your help Google forum for Android SDK is closed

No information in Developer Support Resources

Yes, we post in  Stack Overflow

It is almost impossible to get support for android SDK from Google

-:(((((


LeMi AppsTeam
Visit website - Email Us


LinkedIn    Facebook    Twitter    YouTube    RSS
            Feed    RSS Feed    RSS
            Feed    RSS
            Feed
--
You received this message because you are subscribed to a topic in the Google Groups "Google App Engine" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-appengine/8OVi68GdXEE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/40639f3d-6cd5-47a5-adb2-4922b688f116%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages