http://blog.csdn.net/wangliang198901/article/details/12342845
Http://stackoverflow.com/questions/3856767/android-keeping-a-background-service-alive-preventing-process-death
Http://www.cnblogs.com/cc-Cheng/p/3146143.html
Call
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (r.layout.source_activity);
StartService (New Intent (this, runservice.class));
}
Defined
public class Runservice extends Service {
@Override
public void OnCreate () {
SendNotification ();
}
private void SendNotification () {
LOG.I ("ss", "____________________________sendnotification");
Notification Notification = new Notification ();
Intent notificationintent = new Intent (this, screenrecorderactivity.class);
Pendingintent pendingintent = pendingintent.getactivity (this, 0, notificationintent, 0);
Notification.setlatesteventinfo (This, "3DHome", "Welcome to 3DHome!", pendingintent);
try {
Startforeground (12314, notification);
} catch (Exception e) {
}
}
@Override
public void OnDestroy () {
Stopforeground (TRUE);
}
@Override
Public IBinder Onbind (Intent Intent) {
TODO auto-generated Method Stub
return null;
}
}
Android prevents processes from being killed by third-party software