I've followed steps made by radiolondra57 from Intent Service not working in doze mode to create service running on separate process. I've got a problem that when after startService the onCreate of this service is never called. This is my setup:
Manifest:
<service
android:name=".service.Smart113MainService"
android:enabled="true"
android:exported="true"
android:process=":antiDozeProcessName"
android:label="LocationService">
</service>
In the onCreate of the first Activity this method is called : (yes, the version of the test phone is equal to "O" :) )
private void startServices() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
startService(new Intent(this, Smart113MainService.class));
}
}
Service:
@Override
public void onCreate() {
super.onCreate();
doingSomeStuff();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
startForeground(Smart113NotificationFactory.locationSharingNotificationId, notification.logIntoAppNotification(this).build());
doingMoreStuff();
return START_STICKY;
}
Is this a problem with me not setting action to the Intent that is being send ? That is actually the only difference i can see in our codes..