diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/PushSubscriptionManager.java b/mastodon/src/main/java/org/joinmastodon/android/api/PushSubscriptionManager.java index 91da9115f..e646605d4 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/PushSubscriptionManager.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/PushSubscriptionManager.java @@ -365,6 +365,8 @@ public class PushSubscriptionManager{ } private static void registerAllAccountsForPush(boolean forceReRegister){ + if(!arePushNotificationsAvailable()) + return; for(AccountSession session:AccountSessionManager.getInstance().getLoggedInAccounts()){ if(session.pushSubscription==null || forceReRegister) session.getPushSubscriptionManager().registerAccountForPush(session.pushSubscription); diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java index 8b1590595..cc642d9a5 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SettingsFragment.java @@ -35,6 +35,7 @@ import org.joinmastodon.android.MainActivity; import org.joinmastodon.android.MastodonApp; import org.joinmastodon.android.R; import org.joinmastodon.android.api.MastodonAPIController; +import org.joinmastodon.android.api.PushSubscriptionManager; import org.joinmastodon.android.api.requests.oauth.RevokeOauthToken; import org.joinmastodon.android.api.session.AccountSession; import org.joinmastodon.android.api.session.AccountSessionManager; @@ -166,7 +167,7 @@ public class SettingsFragment extends MastodonToolbarFragment{ @Override public void onDestroy(){ super.onDestroy(); - if(needUpdateNotificationSettings){ + if(needUpdateNotificationSettings && PushSubscriptionManager.arePushNotificationsAvailable()){ AccountSessionManager.getInstance().getAccount(accountID).getPushSubscriptionManager().updatePushSettings(pushSubscription); } }