push gcm token on bind instead of every connect

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 8 
1 file changed, 3 insertions(+), 5 deletions(-)

Detailed changes

src/main/java/eu/siacs/conversations/services/XmppConnectionService.java 🔗

@@ -259,6 +259,9 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
 			fetchRosterFromServer(account);
 			fetchBookmarks(account);
 			sendPresence(account);
+			if (mPushManagementService.pushAvailable(account)) {
+				mPushManagementService.registerPushTokenOnServer(account);
+			}
 			mMessageArchiveService.executePendingQueries(account);
 			connectMultiModeConversations(account);
 			syncDirtyContacts(account);
@@ -298,11 +301,6 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
 				}
 				account.pendingConferenceJoins.clear();
 				scheduleWakeUpCall(Config.PING_MAX_INTERVAL, account.getUuid().hashCode());
-
-				if (mPushManagementService.pushAvailable(account)) {
-					mPushManagementService.registerPushTokenOnServer(account);
-				}
-
 			} else if (account.getStatus() == Account.State.OFFLINE) {
 				resetSendingToWaiting(account);
 				if (!account.isOptionSet(Account.OPTION_DISABLED)) {