本文整理匯總了Java中cn.bmob.v3.Bmob.getServerTime方法的典型用法代碼示例。如果您正苦於以下問題:Java Bmob.getServerTime方法的具體用法?Java Bmob.getServerTime怎麽用?Java Bmob.getServerTime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cn.bmob.v3.Bmob
的用法示例。
在下文中一共展示了Bmob.getServerTime方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getServerTime
import cn.bmob.v3.Bmob; //導入方法依賴的package包/類
public static void getServerTime() {
Bmob.getServerTime(CustomApplication.getInstance(), new GetServerTimeListener() {
@Override
public void onSuccess(long l) {
long deltaTime = System.currentTimeMillis() - l * 1000L;
LogUtil.e("客戶端與服務器端的時間差值 :" + deltaTime);
CustomApplication.getInstance().getSharedPreferencesUtil().setDeltaTime(deltaTime);
}
@Override
public void onFailure(int i, String s) {
LogUtil.e("獲取服務器上的時間失敗" + s + i);
}
});
}
示例2: onAccessibilityEvent
import cn.bmob.v3.Bmob; //導入方法依賴的package包/類
/**
* 監視UI變更事件
*
* @param event AccessibilityEvent
*/
@Override
public void onAccessibilityEvent(AccessibilityEvent event)
{
Bmob.getServerTime(this, new GetServerTimeListener() {
@Override
public void onSuccess(long time) {
// TODO Auto-generated method stub
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String times = formatter.format(new Date(time * 1000L));
//toast("當前服務器時間為:" + times);
}
@Override
public void onFailure(int code, String msg) {
}
});
SharedPreferences sharedPreferences = getSharedPreferences("nico.styTool_preferences", MODE_PRIVATE);
boolean isFirstRun = sharedPreferences.getBoolean("ok_c", true);
//Editor editor = sharedPreferences.edit();
if (isFirstRun)
{
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setSmallIcon(R.mipmap.ic_launcher);
builder.setContentTitle("妮媌");
builder.setContentText("微信搶紅包正在運行");
builder.setOngoing(true);
Notification notification = builder.build();
NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(NOTIFICATION_ID, notification);
}
else
{
}
if (mutex)
{
//Log.w("onAccessibilityEvent", "MUTEX!");
return;
}
mutex = true;
try
{
// Log.i("getPackageName", event.getPackageName().toString());
// Log.i("getRecord", (event.getRecordCount()>0)?event.getRecord(0).toString():"null");
// Log.i("getSource", (event.getSource() != null)?event.getSource().toString():"null");
// Log.i("getText[]", (!event.getText().isEmpty()) ? event.getText().toString() : "[]");
process(event); // 測試表明source和record有參考價值
}
finally
{
mutex = false;
}
}
示例3: getServerTime
import cn.bmob.v3.Bmob; //導入方法依賴的package包/類
/**
* 獲取服務器時間
*/
public static void getServerTime(QueryListener<Long> queryListener){
Bmob.getServerTime(queryListener);
}