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