DEV Community

Chris Richmond
Chris Richmond

Posted on

Register for Notifications on Android SDK 33

Problem: Notifications are not being received after upgrading to Android SDK 33.

Solution: In Android SDK 33 you now have to request permissions to display Notifications. Asking for POST_NOTIFICATIONS alone wasn't sufficient, and some of these maybe overkill but this is what worked for me.

To get the notifications permission, you need to first request permission for the following items:

private string[] PermissionsForNotifications =
            {
                Manifest.Permission.ReceiveBootCompleted,
                Manifest.Permission.WakeLock,
                Manifest.Permission.Vibrate,
                Manifest.Permission.Internet,
                Manifest.Permission.AccessNetworkState,
                Manifest.Permission.PostNotifications,
                Manifest.Permission.ForegroundService,
                "com.google.android.c2dm.permission.RECEIVE",                "com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE",                "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS",
                "android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND"
            };
Enter fullscreen mode Exit fullscreen mode

When calling the registration it seemed the Channel ID was also required.

private int RequestNotificationId = 1000;
ActivityCompat.RequestPermissions(CurrentActivity, PermissionsForNotifications, RequestNotificationId);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)