當前位置: 首頁>>代碼示例>>Java>>正文


Java Context.unbindService方法代碼示例

本文整理匯總了Java中android.content.Context.unbindService方法的典型用法代碼示例。如果您正苦於以下問題:Java Context.unbindService方法的具體用法?Java Context.unbindService怎麽用?Java Context.unbindService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.Context的用法示例。


在下文中一共展示了Context.unbindService方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: b

import android.content.Context; //導入方法依賴的package包/類
private static a b(Context context) throws Exception {
    try {
        context.getPackageManager().getPackageInfo("com.android.vending", 0);
        ServiceConnection bVar = new b();
        Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
        intent.setPackage("com.google.android.gms");
        if (context.bindService(intent, bVar, 1)) {
            try {
                c cVar = new c(bVar.a());
                a aVar = new a(cVar.a(), cVar.a(true));
                context.unbindService(bVar);
                return aVar;
            } catch (Exception e) {
                throw e;
            } catch (Throwable th) {
                context.unbindService(bVar);
            }
        } else {
            throw new IOException("Google Play connection failed");
        }
    } catch (Exception e2) {
        throw e2;
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:25,代碼來源:br.java

示例2: initOpenCV

import android.content.Context; //導入方法依賴的package包/類
public static boolean initOpenCV(String Version, final Context AppContext,
        final LoaderCallbackInterface Callback)
{
    AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback);
    Intent intent = new Intent("org.opencv.engine.BIND");
    intent.setPackage("org.opencv.engine");
    if (AppContext.bindService(intent, helper.mServiceConnection, Context.BIND_AUTO_CREATE))
    {
        return true;
    }
    else
    {
        AppContext.unbindService(helper.mServiceConnection);
        InstallService(AppContext, Callback);
        return false;
    }
}
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:18,代碼來源:AsyncServiceHelper.java

示例3: unbindByContext

import android.content.Context; //導入方法依賴的package包/類
@Override
public void unbindByContext(final Context context) {
    if (!BIND_CONTEXTS.contains(context)) {
        return;
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "unbindByContext %s", context);
    }

    BIND_CONTEXTS.remove(context);


    if (BIND_CONTEXTS.isEmpty()) {
        releaseConnect(false);
    }

    Intent i = new Intent(context, serviceClass);
    context.unbindService(this);
    context.stopService(i);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:BaseFileServiceUIGuard.java

示例4: getAndroidIdViaService

import android.content.Context; //導入方法依賴的package包/類
private static AttributionIdentifiers getAndroidIdViaService(Context context) {
    GoogleAdServiceConnection connection = new GoogleAdServiceConnection();
    Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
    intent.setPackage("com.google.android.gms");
    if(context.bindService(intent, connection, Context.BIND_AUTO_CREATE)) {
        try {
            GoogleAdInfo adInfo = new GoogleAdInfo(connection.getBinder());
            AttributionIdentifiers identifiers = new AttributionIdentifiers();
            identifiers.androidAdvertiserId = adInfo.getAdvertiserId();
            identifiers.limitTracking = adInfo.isTrackingLimited();
            return identifiers;
        } catch (Exception exception) {
            Utility.logd("android_id", exception);
        } finally {
            context.unbindService(connection);
        }
    }
    return null;
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:20,代碼來源:AttributionIdentifiers.java

示例5: initOpenCV

import android.content.Context; //導入方法依賴的package包/類
public static boolean initOpenCV(String Version, final Context AppContext,
        final LoaderCallbackInterface Callback)
{
    AsyncServiceHelper helper = new AsyncServiceHelper(Version, AppContext, Callback);
    if (AppContext.bindService(new Intent("org.opencv.engine.BIND"),
            helper.mServiceConnection, Context.BIND_AUTO_CREATE))
    {
        return true;
    }
    else
    {
        AppContext.unbindService(helper.mServiceConnection);
        InstallService(AppContext, Callback);
        return false;
    }
}
 
開發者ID:wblgers,項目名稱:OpenCV_Android_Plus,代碼行數:17,代碼來源:AsyncServiceHelper.java

示例6: unbindService

import android.content.Context; //導入方法依賴的package包/類
public void unbindService(Context ctx) {
	try {
		// todo eric .check the return value .check the right place to call it
		ctx.unbindService(imServiceConnection);
	} catch (IllegalArgumentException exception) {
		logger.w("im#got exception becuase of unmatched bind/unbind, we sould place to onStop next version.e:%s", exception.getMessage());
	}
	logger.i("unbindservice ok");
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:10,代碼來源:IMServiceConnector.java

示例7: unbind

import android.content.Context; //導入方法依賴的package包/類
/**
 * unbind emulator service
 *
 * @param context context
 */
public void unbind(Context context) {
    if (context == null) return;
    bound = false;
    if (mServiceConnection != null) {
        context.unbindService(mServiceConnection);
    }
    mServiceConnection = null;
    mEmulatorDetectorService = null;
}
 
開發者ID:CodyyAndroid,項目名稱:EmulatorDetect,代碼行數:15,代碼來源:EmulatorDetector.java

示例8: stop

import android.content.Context; //導入方法依賴的package包/類
public void stop (Context context)
{
    context.unbindService(mConnection);
    if (microphone != null)
        microphone.cancel(true);
}
 
開發者ID:guardianproject,項目名稱:haven,代碼行數:7,代碼來源:MicrophoneMonitor.java

示例9: stop

import android.content.Context; //導入方法依賴的package包/類
public void stop(Context context) {
    sensorMgr.unregisterListener(this);
    context.unbindService(mConnection);
}
 
開發者ID:guardianproject,項目名稱:haven,代碼行數:5,代碼來源:AccelerometerMonitor.java

示例10: stop

import android.content.Context; //導入方法依賴的package包/類
public void stop(Context context) {
    sensorMgr.cancelTriggerSensor(sensorListener, bumpSensor);
    context.unbindService(mConnection);
}
 
開發者ID:guardianproject,項目名稱:haven,代碼行數:5,代碼來源:BumpMonitor.java


注:本文中的android.content.Context.unbindService方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。