my service is not working after booting in SDK 23

iam trying to make my service working after Booting and its working in Versions less then 23

But bigger than that it doesnt work

my manifist
Permissions
    <uses-permission-sdk-23 android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

Reciever
        <receiver
            android:enabled="true"
            android:name=".BootReciever"
            android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>

Service
        <service
            android:name=".Services.Azkar_Services"
            android:enabled="true"
            android:exported="true" />

my Broadcast

public class BootReciever extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Intent Rec_Intent = new Intent(context, Azkar_Services.class);
        context.startService(Rec_Intent);

    }
}

thanks

1 answer

  • answered 2018-04-14 15:35 Rishabh Dhiman

    Try removing the category tag from your intent filter and make it like this

        <receiver
                android:enabled="true"
                android:name=".BootReciever"
                android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED" />
                </intent-filter>
            </receiver>
    

    and no need to add this as well

       <uses-permission-sdk-23 android:name="android.permission.RECEIVE_BOOT_COMPLETED" />