本文整理匯總了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;
}
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
}
示例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");
}
示例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;
}
示例8: stop
import android.content.Context; //導入方法依賴的package包/類
public void stop (Context context)
{
context.unbindService(mConnection);
if (microphone != null)
microphone.cancel(true);
}
示例9: stop
import android.content.Context; //導入方法依賴的package包/類
public void stop(Context context) {
sensorMgr.unregisterListener(this);
context.unbindService(mConnection);
}
示例10: stop
import android.content.Context; //導入方法依賴的package包/類
public void stop(Context context) {
sensorMgr.cancelTriggerSensor(sensorListener, bumpSensor);
context.unbindService(mConnection);
}