i like to know is there way to execute code in system app process in android. i found through pending intent we can assign our job to execute in foreign application like alarm manager or notification but still i found job gets execute in same application process .for clear understanding
Here i'm creating alarm manager on buttonclick event.
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Log.d("processstatus", "pid="+android.os.Process.myPid());
//creating an alarm manager
alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, customreciever.class);
pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0);
alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() +10*1000, pendingIntent );
}
});
Through below code, i receive the broadcast event which gets triggered every interval of 10 sec through alarmmanager.
public class customreciever extends BroadcastReceiver {
@Override
public void onReceive(final Context context, Intent intent) {
// Same app process id expecting alaramanager process id
Log.d("processstatus", "pid="+android.os.Process.myPid());
}
}
inside onReceive method i expect different process id other than application process.if this is not possible through pending intent,suggest me any other approach to achieve this.