FileDocCategorySizeDatePackage
LocalService.javaAPI DocAndroid 5.1 API3986Thu Mar 12 22:22:12 GMT 2015android.app.activity

LocalService

public 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.IBinderonBind(android.content.Intent intent)

        Log.i("LocalService", "onBind: " + intent);
        return mBinder;
    
public voidonDestroy()

        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 voidonRebind(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 voidonStart(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 booleanonUnbind(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;