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");
}
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
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/73199d25-e454-4378-a3aa-186ee8e6ace5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.