java - Android how to initiate a BroadcastReceiver when phone restarted -


how can initiate broadcastreceiver whenever user phone has been restarted. , if user kill app, can broadcastreceiver keep running in ground ?

i created parsepushbroadcastreceiver receive push notification parse.com. app receive notification if user opens app.

public class myparsereceiver extends parsepushbroadcastreceiver {      @override     public void onreceive(context context, intent intent) {         super.onreceive(context, intent);         log.i(tag, "onreceive called");          if (intent == null) {             log.e(tag, "receiver intent null");         }          else {             // parse push message , handle accordingly             log.d(tag, "receiver intent data => " + intent.tostring());         }      }//end onreceive        @override     public void onpushopen(context context, intent intent) { ... 

my manifest:

<activity         android:name=".splashactivity"         android:label="@string/app_name"         android:screenorientation="portrait" >         <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter>     </activity>  <service android:name="com.parse.pushservice" />  <receiver android:name="com.parse.parsebroadcastreceiver" >     <intent-filter>         <action android:name="android.intent.action.boot_completed" />         <action android:name="android.intent.action.receive_boot_completed" />         <action android:name="android.intent.action.user_present" />     </intent-filter> </receiver>  <receiver     android:name="com.my.app.core.myparsereceiver"     android:exported="false" >     <intent-filter>         <action android:name="android.intent.action.boot_completed" />         <action android:name="android.intent.action.user_present" />         <action android:name="com.parse.push.intent.receive" />         <action android:name="com.parse.push.intent.delete" />         <action android:name="com.parse.push.intent.open" />     </intent-filter> </receiver> <receiver     android:name="com.parse.gcmbroadcastreceiver"     android:permission="com.google.android.c2dm.permission.send" >     <intent-filter>         <action android:name="android.intent.action.boot_completed" />         <action android:name="android.intent.action.receive_boot_completed" />         <action android:name="com.google.android.c2dm.intent.receive" />         <action android:name="com.google.android.c2dm.intent.registration" />          <category android:name="com.my.app" />     </intent-filter> </receiver>  <meta-data     android:name="com.parse.push.notification_icon"     android:resource="@drawable/ic_launcher" /> 

could please try setting android:exported="true" receiver tag in manifest


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -