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