Hi,
I have an SMS broadcast receiver in my application with a static boolean value to make the receiver active or not.
public class SmsListener extends BroadcastReceiver {
public static boolean activated = false;
@Override
public void onReceive(Context context, Intent intent)
if (activated){ //do something
}
...
}
}
I have then a widget to activate or not the sms receiver (through this static value). Everything works well but I just noticed that, if the phone memory gets low, the sms listener loses its state and the application doesn't work as expected. I guess it is related to android lifecycle. I have no service in background and the system kills the process. Should the approach I used be avoided? Should I always start a service only to avoid android process kill?
Thanks
Tobia Loschiavo