Ejemplo n.º 1
0
 @Override
 public void onRegistered(String registrationId) {
   String pkgName = getApplicationContext().getPackageName();
   String info =
       String.format(
           "enabled:%s  isRegistered:%s  DeviceToken:%s "
               + "SdkVersion:%s AppVersionCode:%s AppVersionName:%s",
           mPushAgent.isEnabled(),
           mPushAgent.isRegistered(),
           mPushAgent.getRegistrationId(),
           MsgConstant.SDK_VERSION,
           UmengMessageDeviceConfig.getAppVersionCode(MainActivity.this),
           UmengMessageDeviceConfig.getAppVersionName(MainActivity.this));
   SPUtils.saveSPData("token", mPushAgent.getRegistrationId());
   Log.i("TAG", "updateStatus:" + info);
   Log.i("TAG", "=============================");
 }
Ejemplo n.º 2
0
  @Override
  public void initData() {
    mPushAgent = PushAgent.getInstance(context);
    //        if (!mPushAgent.isEnabled()) {
    mPushAgent.enable(mRegisterCallback);
    //        }

    String device_token = UmengRegistrar.getRegistrationId(context);
    showLogD("device_token " + device_token);
    Log.i("TAG", "device_token " + device_token);
    SPUtils.saveSPData("token", device_token);
    mLocationClient = ((MyApplication) getApplication()).mLocationClient;

    //        register(device_token);
    copyDB(DBNAME);
    copyDB(SCHOOL);
    copyDB(TEACHER_TYPE);
    initLocation();
    mLocationClient.start();
    setListener();
  }