当前位置: 首页>>代码示例>>Java>>正文


Java OnConnectionListener类代码示例

本文整理汇总了Java中org.md2k.datakitapi.messagehandler.OnConnectionListener的典型用法代码示例。如果您正苦于以下问题:Java OnConnectionListener类的具体用法?Java OnConnectionListener怎么用?Java OnConnectionListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OnConnectionListener类属于org.md2k.datakitapi.messagehandler包,在下文中一共展示了OnConnectionListener类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: set

import org.md2k.datakitapi.messagehandler.OnConnectionListener; //导入依赖的package包/类
@Override
public void set() {
    DataKitAPI dataKitAPI=DataKitAPI.getInstance(modelManager.getContext());
    Log.d(TAG,"DataKitConnectManager...set()..before...isConnected="+dataKitAPI.isConnected());

    if (dataKitAPI.isConnected()) {
        notifyIfRequired(new Status(rank, Status.SUCCESS));
    }else{
        status=new Status(rank, Status.DATAKIT_NOT_AVAILABLE);
        dataKitAPI=DataKitAPI.getInstance(modelManager.getContext());
        try {
            dataKitAPI.connect(new OnConnectionListener() {
                @Override
                public void onConnected() {
                    Log.d(TAG,"connected...");
                    notifyIfRequired(new Status(rank, Status.SUCCESS));
                }
            });
        } catch (DataKitException e) {
            LocalBroadcastManager.getInstance(modelManager.getContext()).sendBroadcast(new Intent(Constants.INTENT_RESTART));
        }
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-Study,代码行数:24,代码来源:DataKitConnectManager.java

示例2: connect

import org.md2k.datakitapi.messagehandler.OnConnectionListener; //导入依赖的package包/类
public synchronized void connect(OnConnectionListener callerOnConnectionListener) throws DataKitException {
    if (!isInstalled(context, Constants.PACKAGE_NAME)) {
        throw new DataKitNotFoundException(new Status(Status.ERROR_NOT_INSTALLED));
    } else if (isConnected()) callerOnConnectionListener.onConnected();
    else {
        dataKitAPIExecute.connect(callerOnConnectionListener);
        handler.postDelayed(runnableSyncHF,SYNC_TIME_HF);
    }
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKitAPI,代码行数:10,代码来源:DataKitAPI.java


注:本文中的org.md2k.datakitapi.messagehandler.OnConnectionListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。