I have implemented a service to run with the alarm manager. I read this link: Should I use android: process =“:remote” in my receiver?
I thought this would be a nice feature for my app, since i want the service to keep running after my app is down.
But when i add this line of configuration to my receiver on the manifest, my service stops being called.
Any clues?
Here is my receiver declaration:
This works:
<receiver
        android:name=".service.MyAlarmReceiver"
        android:enabled="true"
        android:exported="false">
        <intent-filter>
            <action android:name=".service.MyAlarmReceiver"></action>
        </intent-filter>
    </receiver>
This wont'n work:
<receiver
        android:name=".service.MyAlarmReceiver"
        android:enabled="true"
        android:process=":remote"
        android:exported="false">
        <intent-filter>
            <action android:name=".service.MyAlarmReceiver"></action>
        </intent-filter>
    </receiver>
public class MyAlarmReceiver extends BroadcastReceiver {
    public static final int REQUEST_CODE = 12345;
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.d(TAG, "Time to start scan service!");
        Intent intent = new Intent(context, BeaconFinderService.class);
        context.startService(intent);
    }
}
This is how i start my alarm manager:
// Construct an intent that will execute the AlarmReceiver
Intent intent = new Intent(getApplicationContext(), MyAlarmReceiver.class);
final PendingIntent pIntent = PendingIntent.getBroadcast(getApplicationContext(), MyAlarmReceiver.REQUEST_CODE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), Constants.BLE_SERVICE_LOOP_TIME, pIntent);
 
    