本文整理汇总了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);
}