Beispiel #1
0
  private void postClientId() {
    if (!TextUtils.isEmpty(userShopInfoBean.getBusinessId())) {
      /** 获取手机唯一识别码CID */
      if (PushManager.getInstance().getClientid(this) != null) {
        mClientId = PushManager.getInstance().getClientid(this);
      }
      String reqTime = AbDateUtil.getDateTimeNow();
      String uuid = AbStrUtil.getUUID();
      System.out.println("向服务器发送手机识别码" + mClientId);
      try {
        okHttpsImp.postPhoneClientId(
            uuid,
            "app",
            reqTime,
            userShopInfoBean.getUserId(),
            userShopInfoBean.getBusinessId(),
            mClientId,
            "01",
            new MyResultCallback<String>() {

              @Override
              public void onResponseResult(Result result) {}

              @Override
              public void onResponseFailed(String msg) {}
            });
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  }
Beispiel #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    UmengUpdateAgent.setUpdateOnlyWifi(false);
    UmengUpdateAgent.update(this);
    setContentView(R.layout.activity_main);

    PushManager.getInstance().initialize(this.getApplicationContext());

    if (!Check.isNotFirstLoc(this)) {
      PreferencesUtils.putBooleanToSPMap(MainActivity.this, PreferencesUtils.Keys.IS_LOC, true);
      mLocationClient = new LocationClient(this.getApplicationContext());
      mMyLocationListener = new MyLocationListener();
      mLocationClient.registerLocationListener(mMyLocationListener);
      initLoc();
    }

    Intent intent = new Intent(this, CacheService.class);
    startService(intent);
    initData();
    findViewById();
    initUI();
    setListener();

    if (!Check.isNotFirst(this)) {
      startThread();
    }
  }
Beispiel #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GezitechService.getInstance().appendActivity(this);
    setContentView(R.layout.activity_zhuye);

    // user = GezitechService.getInstance().getCurrentLoginUser(this);

    home = (RadioButton) findViewById(R.id.home);
    session = (RadioButton) findViewById(R.id.session);
    person = (RadioButton) findViewById(R.id.person);
    group = (RadioGroup) findViewById(R.id.zhuye_group);
    nearby = (RadioButton) findViewById(R.id.nearby);

    // 初始化个推推送
    PushManager.getInstance().initialize(this.getApplicationContext());

    // 提示消息
    ll_unreadcount = (LinearLayout) findViewById(R.id.ll_unreadcount);
    tv_unreadcount = (TextView) findViewById(R.id.tv_unreadcount);
    // 附近人有新消息提示 只显示红点
    ll_nearbycount = (LinearLayout) findViewById(R.id.ll_nearbycount);
    // 喜欢 和 评论的提示条数
    ll_like_comment_count = (LinearLayout) findViewById(R.id.ll_like_comment_count);
    tv_like_comment_count = (TextView) findViewById(R.id.tv_like_comment_count);
    // 计算未读的消息
    unreadcount();
    // 计算 喜欢和 评论的未读消息
    like_comment_count(tv_like_comment_count, ll_like_comment_count);

    home.setOnClickListener(this);
    session.setOnClickListener(this);
    person.setOnClickListener(this);
    nearby.setOnClickListener(this);
    fragmentManager = getSupportFragmentManager();

    mFragments = new Fragment[4];
    fghome = HomeFramgent.newInstance();
    fsession = SessionFramgent.newInstance();
    fperson = PersonFramgent.newInstance();
    fNearby = NearbyFramgent.newInstance();

    mFragments[0] = fghome;
    mFragments[1] = null;
    mFragments[2] = null;
    mFragments[3] = null;
    fragmentManager.beginTransaction().add(R.id.zhuye_content, fghome).show(fghome).commit();

    IntentFilter filter = new IntentFilter();
    filter.addAction(Constant.NEW_MESSAGE_ACTION);
    filter.addAction(Constant.LIKE_COMMENT_ACTION);
    registerReceiver(receiver, filter);

    _jumpActivity(this.getIntent());

    setSelectFragment();
  }
Beispiel #4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow()
        .setFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loading);
    //		startActivity(new Intent(LoadingActivity.this, CameraSettingsTabActivity.class));
    final MyViewerHelper myViewerHelper = MyViewerHelper.getInstance(getApplicationContext());
    myViewerHelper.setLoginListener(
        new LoginListener() {

          @Override
          public void onLoginResult(boolean success) {
            if (success) {
              boolean haveShowGuide =
                  PrefUtils.getBoolean(LoadingActivity.this, PrefUtils.HAVE_SHOW_GUIDE);
              Intent intent = new Intent();
              if (haveShowGuide) {
                if (mUserInfo.isLogin) {
                  intent.setClass(getApplicationContext(), CameraListActivity.class);
                } else {
                  intent.setClass(getApplicationContext(), LoginActivity.class);
                }
              } else {
                intent.setClass(getApplicationContext(), GuideActivity.class);
                intent.putExtra(GuideActivity.START_AVS_ACTIVITY, true);
              }
              myViewerHelper.setLoginListener(null);
              startActivity(intent);
              LoadingActivity.this.finish();
            }
          }
        });

    mUserInfo = UserInfo.getUserInfo(this.getApplicationContext());

    // init getui.
    PushManager.getInstance().initialize(this.getApplicationContext());
  }
Beispiel #5
0
  @Override
  public void onReceive(Context context, Intent intent) {
    Bundle bundle = intent.getExtras();
    Log.d("GetuiSdk", "onReceive() action=" + bundle.getInt("action"));
    switch (bundle.getInt(PushConsts.CMD_ACTION)) {
      case PushConsts.GET_MSG_DATA:
        // 获取透传数据
        // String appid = bundle.getString("appid");
        byte[] payload = bundle.getByteArray("payload");

        String taskid = bundle.getString("taskid");
        String messageid = bundle.getString("messageid");

        // smartPush第三方回执调用接口,action范围为90000-90999,可根据业务场景执行
        boolean result =
            PushManager.getInstance().sendFeedbackMessage(context, taskid, messageid, 90001);
        System.out.println("第三方回执接口调用" + (result ? "成功" : "失败"));

        if (payload != null) {
          String data = new String(payload);

          Log.d("GetuiSdk", "Got Payload:" + data);
          // TODO:处理透传消息
          showNotification("Title", data, MainActivity.class);
        }
        break;
      case PushConsts.GET_CLIENTID:
        // 获取ClientID(CID)
        // 第三方应用需要将CID上传到第三方服务器,并且将当前用户账号和CID进行关联,以便日后通过用户账号查找CID进行消息推送
        PushConfig.clientId = bundle.getString("clientid");
        syncClientId();
        break;
      default:
        break;
    }
  }
Beispiel #6
0
 private void initGetui() {
   PushManager.getInstance().initialize(this.getApplicationContext());
 }