LocalServicepublic class LocalService extends android.app.Service
Fields Summary |
---|
private final android.os.IBinder | mBinder | private android.os.IBinder | mReportObject | private int | mStartCount |
Constructors Summary |
---|
public LocalService()
|
Methods Summary |
---|
public android.os.IBinder | onBind(android.content.Intent intent)
Log.i("LocalService", "onBind: " + intent);
return mBinder;
| public void | onDestroy()
Log.i("LocalService", "onDestroy: mReportObject=" + mReportObject);
if (mReportObject != null) {
try {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(ServiceTest.SERVICE_LOCAL);
mReportObject.transact(
ServiceTest.DESTROYED_CODE, data, null, 0);
data.recycle();
} catch (RemoteException e) {
}
}
| public void | onRebind(android.content.Intent intent)
Log.i("LocalService", "onUnbind: " + intent);
if (mReportObject != null) {
try {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(ServiceTest.SERVICE_LOCAL);
mReportObject.transact(
ServiceTest.REBIND_CODE, data, null, 0);
data.recycle();
} catch (RemoteException e) {
}
}
| public void | onStart(android.content.Intent intent, int startId)
//Log.i("LocalService", "onStart: " + intent);
if (intent.getExtras() != null) {
mReportObject = intent.getExtras().getIBinder(ServiceTest.REPORT_OBJ_NAME);
if (mReportObject != null) {
try {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(ServiceTest.SERVICE_LOCAL);
data.writeInt(mStartCount);
mStartCount++;
mReportObject.transact(
ServiceTest.STARTED_CODE, data, null, 0);
data.recycle();
} catch (RemoteException e) {
}
}
}
| public boolean | onUnbind(android.content.Intent intent)
Log.i("LocalService", "onUnbind: " + intent);
if (mReportObject != null) {
try {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(ServiceTest.SERVICE_LOCAL);
mReportObject.transact(
ServiceTest.UNBIND_CODE, data, null, 0);
data.recycle();
} catch (RemoteException e) {
}
}
return true;
|
|