コード例 #1
0
  public XmppManager getPushManager() {
    if (null != notificationService) {
      return notificationService.getPushManager();

    } else {
      // String username = Preferences.getUserName(Application.sharePref);
      // loginChatClient(username, username);
      Log.e(
          "notificationService====",
          "notificationServiceConnection=" + notificationServiceConnection);
      Log.e("notificationService====", "BeforeBindnotificationService=" + notificationService);

      this.bindService(
          NotificationService.getIntent(this),
          notificationServiceConnection,
          Context.BIND_AUTO_CREATE);
      loginXmppClient(
          Preferences.getUserName(Application.sharePref),
          Preferences.getUserName(Application.sharePref),
          notificationService.getPushManager());
      Log.e("notificationService====", "AffterBindnotificationService=" + notificationService);
      if (notificationService != null) {
        return notificationService.getPushManager();
      }
      return null;
    }
  }
コード例 #2
0
 @Override
 public void onServiceConnected(ComponentName name, IBinder service) {
   notificationService = ((NotificationServiceBinder) service).getService();
   if (notificationCallback != null) {
     notificationCallback.doStuff();
   }
   //			String deviceId = DeviceInfoUtil.getDeviceId(Application.this);
   String token = PushUtil.createMD5Token(Application.this);
   loginXmppClient(token, token, notificationService.getPushManager());
 }