You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
848 B
24 lines
848 B
package org.r3pek.droiduptime;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.util.Log;
|
|
|
|
public class DroidUptimeServiceManager extends BroadcastReceiver {
|
|
|
|
public void onReceive(Context arg0, Intent arg1) {
|
|
if (arg1.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
|
|
ComponentName comp = new ComponentName(arg0.getPackageName(), DroidUptimeService.class.getName());
|
|
ComponentName service = arg0.startService(new Intent().setComponent(comp));
|
|
if (null == service){
|
|
// something really wrong here
|
|
Log.e(getClass().getName(), "Could not start service " + comp.toString());
|
|
}
|
|
} else {
|
|
Log.e(getClass().getName(), "Received unexpected intent " + arg1.toString());
|
|
}
|
|
}
|
|
|
|
}
|
|
|