I have an application which is using for performance testing. However, this application always be kill in the background in about 5 min later. I want to know how to let it stay alive.(In API 23)
I have tried startForeground(), but it seems didn't work. I logout the oom_adj and oom_score_adj and get the result 3 and 200. Did it do some effect?
Use below
Intent intent = new Intent();
ComponentName componentName = new ComponentName(getPackageName(), <Your IntentService>.class.getName());
// Start the service, keeping the device awake
try {
startWakefulService(getApplicationContext(), intent.setComponent(componentName));
} catch (Exception e) {
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.