-1

my boot reciver:

  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;

 import gd.rf.ddl.vipchild.service.BootService;


 public class DeviceBootReceiver  extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    Intent startServiceIntent = new Intent(context, BootService.class);
    context.startService(startServiceIntent);
}


}

my android_mainfiest:

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gd.rf.ddl.vipchild">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".walkin">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="gd.rf.ddl.vipchild.Home"
        android:label="@string/app_name" >
    </activity>



    <receiver android:name="gd.rf.ddl.vipchild.DeviceBootReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED"/>
        </intent-filter>
    </receiver>

      <service android:enabled="true" 
    android:name="gd.rf.ddl.vipchild.service.BootService" >

    </service>
  </application>
  </manifest>

when i close my app my service also close i want to create service that start on boot and never ending service,on restart my device bootreciver class not starting app service,i cant found why its happening.

ddl.smart
  • 1
  • 3

1 Answers1

-1

Use started service and make it as START_STICKY. for more help paste your service code.

  • Consider adding substantial information to help the OP. You can always use comments section to ask questions. – wandermonk May 15 '18 at 17:10