Note that there are some explanatory texts on larger screens.

plurals
  1. POSms Receiver via BroadcastReceiver
    text
    copied!<p>I am working on an app which is sending and receiving SMS . sending is OK, but in receiving the SMS when application is running the receiving is OK too but when I close the app the onReceive method of my BroadcastReceiver doesn't execute , actually I am working on android 4 and I heard from a college which it could be up to android's version that means android 4 doesn't let app to receive SMS when their are not showing to user . is it right ?</p> <p>here is the code which is OK (I think so)</p> <pre><code> public class SMSReceiver extends BroadcastReceiver { private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED"; private static final String ACTIVITY_SERVICE = "activity"; @Override public void onReceive(Context context, Intent intent) { // something } } </code></pre> <p>here is the manifest related content </p> <pre><code>&lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt; &lt;uses-permission android:name="android.permission.SEND_SMS" /&gt; &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt; &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /&gt; &lt;receiver android:name="com.ssol.SMSReceiver" android:permission="android.permission.BROADCAST_SMS" &gt; &lt;intent-filter android:priority="2147483647" &gt; &lt;action android:name="android.intent.action.PHONE_STATE" /&gt; &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload