当前位置: 首页>>代码示例>>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;未经允许,请勿转载。