Methods Summary |
---|
public android.os.IBinder | getBinder()
return null;
|
protected void | onCreate()
mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
// This is who should be launched if the user selects our persistent
// notification.
mInvokeIntent = new Intent(this, ServiceStartArgumentsController.class);
// Start up the thread running the service. Note that we create a
// separate thread because the service normally runs in the process's
// main thread, which we don't want to block.
Thread thr = new Thread(null, this, "ServiceStartArguments");
thr.start();
|
protected void | onDestroy()
while (mServiceLooper == null) {
synchronized (this) {
try {
wait(100);
} catch (InterruptedException e) {
}
}
}
mServiceLooper.quit();
// Cancel the persistent notification.
mNM.cancel(R.string.service_arguments_started);
// Tell the user we stopped.
mNM.notifyWithText(R.string.service_arguments_stopped,
getText(R.string.service_arguments_stopped),
NotificationManager.LENGTH_SHORT,
null);
|
protected void | onStart(int startId, android.os.Bundle arguments)
System.out.println("Starting #" + startId + ": " + arguments);
while (mServiceHandler == null) {
synchronized (this) {
try {
wait(100);
} catch (InterruptedException e) {
}
}
}
Message msg = mServiceHandler.obtainMessage();
msg.arg1 = startId;
msg.obj = arguments;
mServiceHandler.sendMessage(msg);
Log.i("ServiceStartArguments", "Sending: " + msg);
|
public void | run()
Looper.prepare();
mServiceLooper = Looper.myLooper();
mServiceHandler = new ServiceHandler();
Looper.loop();
|