Android学习笔记(二)--iparty登陆界面

  打开应用,判断是否第一次使用。

 1     private void beforeInitMenu() {
 2         AppContext appContext = (AppContext) getApplicationContext();
 3 
 4         if (appContext.isFirstLogin()) {
 5             // 第一次启动
 6             //如果第一次启动,出现5张引导图片。
 7             Intent intent = new Intent(this, GuideActivity.class);
 8             startActivity(intent);
 9         } else if (!appContext.isLogin()) {
10             // 检查是否登陆
11             UIHelper.showLoginPage(this);
12         } else {
13             // 登陆聊天服务器
14             OpenfireLoginTask task = new OpenfireLoginTask(this,
15                     appContext.getLoginUid() + "", appContext.getLoginInfo()
16                             .getPwd());
17             task.execute();
18         }
19 
20         // 网络连接判断
21         if (!appContext.isNetworkConnected()) {
22             T.showLong(this, R.string.network_not_connected);
23         }
24 
25         // 开启百度推送服务
26         // 以apikey的方式登录,一般放在主Activity的onCreate中
27         PushManager.startWork(getApplicationContext(),
28                 PushConstants.LOGIN_TYPE_API_KEY,
29                 ApiKeyUtil.getMetaValue(this, "api_key"));
30 
31         // 检查新版本
32         if (appContext.isCheckUp()) {
33             UpdateManager.getUpdateManager().checkAppUpdate(this, false);
34         }
35 
36         // 注册消息接收广播
37         IntentFilter filter = new IntentFilter();
38         filter.addAction(OpenfireConstant.NEW_MESSAGE_ACTION);
39         registerReceiver(receiver, filter);
40 
41     }

 

posted @ 2014-05-30 14:21  birdhack  阅读(207)  评论(0编辑  收藏  举报