Exemplo 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", "=============================");
 }
Exemplo n.º 2
0
  @Override
  public void onCreate() {
    super.onCreate();
    mInstance = this;
    /** 初始化 */
    AiYouManager.getInstance(this);
    NetWorkManager.getInstance(this);
    SwitchManager.getInstance(this);

    if (FileManager.checkSDCard()) {
      removeExpiredCache();
    } else {
      Toast.makeText(getBaseContext(), "SD卡未安装或空间不足", Toast.LENGTH_SHORT).show();
    }

    try {
      // 百度地图初始化
      SDKInitializer.initialize(this);
      initEngineManager(this);
    } catch (Exception e) {
      Logcat.e(TAG, "百度地图初始化错误");
    }

    /** 友盟推送 */
    mPushAgent = PushAgent.getInstance(this);
    mPushAgent.setDebugMode(false);
    /** 友盟用户反馈 */
    FeedbackPush.getInstance(this).init(false);
    /** 友盟自动更新 */
    // 非wifi环境更新开启,要放在updata()之前调用
    UmengUpdateAgent.setUpdateOnlyWifi(SwitchManager.getInstance(this).getUpdateOnlyWifi());
    UmengUpdateAgent.update(this);
    /** 友盟在线参数—— 获取帖子尾巴 */
    MobclickAgent.updateOnlineConfig(this);
    BBSManager.getInstance(this).setAppTail(MobclickAgent.getConfigParams(this, "app_tail"));
    // 获取iptv频道列表
    IptvManager.getChanelList();

    MapHelper.initMapDatas(this);

    initSections();
    initFavorite();
  }
Exemplo n.º 3
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();
  }
Exemplo n.º 4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // setBehindContentView(R.layout.fragment_menu);//滑动的那个页面
    setContentView(R.layout.activity_home);
    MyActivityManager.add(this);
    mScreenWidth = getWindowManager().getDefaultDisplay().getWidth();

    lv_setting_drawer = (ListView) findViewById(R.id.lv_setting_drawer);
    mDrawerLayout = (DrawerLayout) findViewById(R.id.layout_drawer);
    fm = getFragmentManager();
    fm.beginTransaction().replace(R.id.fl_main_content, new HomeFragment()).commit();
    PushAgent.getInstance(this).onAppStart(); // 统计应用启动数据
    initLeftDrawer();
    sp = getSharedPreferences("config", MODE_PRIVATE);
  }
Exemplo n.º 5
0
  private void setUpUmengFeedback() {
    fb = new FeedbackAgent(this);
    // check if the app developer has replied to the feedback or not.
    fb.sync();
    fb.openAudioFeedback();
    fb.openFeedbackPush();

    // fb.setWelcomeInfo();
    fb.setWelcomeInfo("请输入您的意见和建议,您的支持是作者最大的动力,谢谢。");
    FeedbackPush.getInstance(this).init(true);
    PushAgent.getInstance(this).setPushIntentServiceClass(MyPushIntentService.class);

    new Thread(
            new Runnable() {
              @Override
              public void run() {
                boolean result = fb.updateUserInfo();
              }
            })
        .start();
  }
Exemplo n.º 6
0
 @Override
 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   // TODO Auto-generated method stub
   switch (buttonView.getId()) {
     case R.id.settings_push_switch:
       if (isChecked) {
         // 接受推送,储存值
         sputil.setValue("isPushOn", true);
         PushAgent mPushAgent = PushAgent.getInstance(mContext);
         mPushAgent.enable();
       } else {
         // 关闭推送,储存值
         sputil.setValue("isPushOn", false);
         PushAgent mPushAgent = PushAgent.getInstance(mContext);
         mPushAgent.disable();
       }
       break;
     default:
       break;
   }
 }
 public void registerYmengMessageHandler() {
   PushAgent.getInstance(mContext).setMessageHandler(new MyYmengMessageHandler());
 }
Exemplo n.º 8
0
  /** 这个也是一个抽象的方法不需要主类实现 这个是程序的初始化的方法 */
  @Override
  public void Nav() {
    context = this;
    activity = this;
    view = LayoutInflater.from(this).inflate(R.layout.activity_main, null);

    // 注册推送
    PushAgent pushAgent = PushAgent.getInstance(this);
    pushAgent.onAppStart();
    //        try {
    //            pushAgent.addAlias("*****@*****.**" , ALIAS_TYPE.WEIXIN);
    //        } catch (Exception e) {
    //            e.printStackTrace();
    //        }
    pushAgent.enable();
    pushAgent.setPushIntentServiceClass(MyPushIntentService.class);

    user = User.getInstance();
    if (User.ONLINE.equals(user.getUserLogin())) {
      switch (user.getUserLoginStyle()) {
        case ActivityCode.WEIXIN:
          // 判断保存本地的access_token是否有效,有效继续使用,无效则获取新的access_token
          new Token(context).CheckAccess_Token();
          break;
      }
    }

    setLeftTitleVisiable(false);
    setLeftImageVisiable(false);

    setTileBar(0);
    setNavColor(R.color.White);

    checkUpdate = new CheckUpdate(context);

    new LocalUtils(context).getCityName(this);
    HttpURL.CityName = User.getInstance().getUserCity();

    setNavContent(view);

    // 首先实例化时间监听的广播
    registerTime = new RegisterTime(this);

    // 注册网络发生改变的广播
    wifiReceiver = new WifiReceiver(getSupportFragmentManager(), false);
    IntentFilter filter = new IntentFilter();
    filter.addAction(ReceiverURL.CONNECTIVITY_CHANGE);
    filter.addAction(ReceiverURL.RSSI_CHANGED);
    filter.addAction(ReceiverURL.STATE_CHANGE);
    filter.addAction(ReceiverURL.WIFI_STATE_CHANGED);
    // 注册广播接收器
    registerReceiver(wifiReceiver, filter);

    setNavTxt(getResources().getColor(R.color.Blue), getResources().getColor(R.color.Grey));
    int[] Pic =
        new int[] {R.mipmap.homelink1, R.mipmap.homefind1, R.mipmap.homeshop1, R.mipmap.homeme1};
    int[] Pic1 =
        new int[] {R.mipmap.homelink, R.mipmap.homefind, R.mipmap.homeshop, R.mipmap.homeme};
    setNavPic(Pic, Pic1);

    setNav1(getResources().getString(R.string.Nav1));
    setNav2(getResources().getString(R.string.Nav2));
    setNav3(getResources().getString(R.string.Nav3));
    setNav4(getResources().getString(R.string.Nav4));

    intentFragment(new Fragment1());
    // 检查更新操作
    checkUpdate.Update(0);
  }
Exemplo n.º 9
0
 private void initUmengPush() {
   PushAgent mPushAgent = PushAgent.getInstance(this.getApplicationContext());
   mPushAgent.enable();
 }
Exemplo n.º 10
0
 @Override
 protected void initData() {
   PushAgent mPushAgent = PushAgent.getInstance(this);
   mPushAgent.enable();
 }