@Override public void run() { // 论坛回复 String strJson = Refer.getReferInfo(BBSService.this, ReferType.REPLY); if (strJson == null) { return; } Refer refer = new Refer(strJson); if (refer.new_count > 0) { if (null != mHandler) { mHandler.sendEmptyMessage(MSG_REPLY); // 设置 BBSManager.getInstance(BBSService.this) .setBBSNotificationRefer(ReferType.REPLY, refer.new_count); // 发送特定action的广播 Intent intent = new Intent(); intent.setAction(BBSManager.REFER_RECEIVER_ACTION); intent.putExtra(KEY_NEW_COUNT, refer.new_count); intent.putExtra(KEY_TYPE, NotifyType.REPLY); sendBroadcast(intent); } } else { if (mHandler != null) { BBSManager.getInstance(BBSService.this).setBBSNotificationRefer(ReferType.REPLY, 0); mHandler.sendEmptyMessage(MSG_NO_REPLY); } } }
@Override public void run() { // 论坛新邮件 String strJson = Mailbox.getMailBoxInfo(BBSService.this); if (strJson == null) { return; } Mailbox mailbox = new Mailbox(strJson); if (mailbox.new_mail) { if (null != mHandler) { mHandler.sendEmptyMessage(MSG_MAIL); // 设置 BBSManager.getInstance(BBSService.this).setBBSNotificationMail(true); // 发送特定action的广播 Intent intent = new Intent(); intent.setAction(BBSManager.REFER_RECEIVER_ACTION); intent.putExtra(KEY_TYPE, NotifyType.MAIL); sendBroadcast(intent); } } else { if (null != mHandler) { BBSManager.getInstance(BBSService.this).setBBSNotificationMail(false); mHandler.sendEmptyMessage(MSG_NO_MAIL); } } }
private void checkNewMessage() { // 检查是否是访客身份 if (BBSManager.GUEST.equals(BBSManager.getInstance(getBaseContext()).getUserId())) { return; } // 是否有网络连接 if (!NetWorkManager.getInstance(getBaseContext()).isNetAvailable()) { return; } ThreadUtils.execute(new ReplyRunnable()); ThreadUtils.execute(new AtRunnable()); ThreadUtils.execute(new MailRunnable()); }
@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(); }