My app look at arriveed email in K9 client in this way…
1) AndroidManifest:
<receiver
android:name="com.myapp.K9MailReceiver">
<intent-filter>
<action
android:name="com.fsck.k9.intent.action.EMAIL_RECEIVED" />
<data
android:scheme="email" />
</intent-filter>
</receiver>
2) My Broadcast Receiver:
public class K9MailReceiver extends BroadcastReceiver {
@Override
public void onReceive(final Context context, final Intent intent) {
final Intent serviceIntent = new Intent(context, MyService.class);
serviceIntent.putExtra(Prepare.MAIL, intent.getExtras());
context.startService(serviceIntent);
}
}
My question: is it possible that Android decides to kill my K9MailReceiver class to free memory? If yes, how to prevent this?
Any
BroadcastReceiverdoesn’t appear constantly in memory. It get’s instantiated when the intent gets received , and killed afteronReceive()method is finished.