The method or property Expo.Notifications.setBadgeNumberAsync is not available on android, are you sure you've linked all the native dependencies properly?

  1. SDK Version: 35
  2. Platforms(Android/iOS/web/all): Android
if (
      this.state.appState.match(/inactive|background/) &&
      nextAppState === "active" &&
      Platform.OS === "ios"
    ) {
      Notifications.setBadgeNumberAsync(0);
    }

Hey @pandeykamal,

If you are using SDK35, can you make sure you are using the legacy notifications module https://docs.expo.io/versions/v38.0.0/sdk/legacy-notifications/ rather than the new expo-notifications module that is only compatible with SDK38+.

Cheers,
Adam

@adamjnav yeah I am importing it as follow

import { AppLoading, Notifications } from "expo"

Sorry I should’ve noticed the method you were calling rather than the import statement. That method is not available on Android which is expected behavior. “This method will reject on Android.” https://docs.expo.io/versions/v38.0.0/sdk/legacy-notifications/#notificationssetbadgenumberasyncnumber

If setting badge count is a necessary function of your app, our new Notifications module supports both Android and iOS. (as long as the Android launcher supports icon badges)

Thanks @adamjnav does checking the platform will not get rid of the error?

I am still on 35 and want to get rid of this one until i go with 38.

Yes, that should do the trick until you are able to upgrade to SDK38!

@adamjnav but I am getting lots of notifications on sentry for this one.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.