Whitescreen when reopen a MAUI app from background when app was first opened from push message

alask 0 Reputation points
2024-07-02T10:53:40.18+00:00

Hi,

we have a maui blazor app and there is a strange behavior on Android.

The app receives push message from firebase.

When app is completely closed (not in background) and an incoming push message is clicked the app opens and handles the push message. But when the app goes to background after clicking back button, and then you reopen the app from background, there is a white screen.

This behavior is only when app was opened from push. When opened normally, there is no problem to reopen the app from background.

What could be helpful to answer:

Settings of MainActivity

[Activity(Theme = "@style/Maui.SplashTheme", ResizeableActivity = true, LaunchMode = LaunchMode.SingleTask, Label = "App", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]

possibly important settings of the incoming push message (pendingintent) that are provided to the app:

What could be the reason and how to solve it?

            var intent = new Intent(this, typeof(MainActivity));
            intent.AddFlags(ActivityFlags.ClearTop);

            intent.AddFlags(ActivityFlags.SingleTop);

            PendingIntent? pendingIntent = null;

            if (Build.VERSION.SdkInt >= BuildVersionCodes.S)

            {

                pendingIntent = PendingIntent.GetActivity

               (this, pushCounter, intent, PendingIntentFlags.Immutable);

            }

            else

            {

                pendingIntent = PendingIntent.GetActivity(this, pushCounter, intent, PendingIntentFlags.OneShot);

            }
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,607 questions
Microsoft Intune Android
Microsoft Intune Android
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Android: An open-source mobile platform based on the Linux kernel, developed by Google, and maintained by the Open Handset Alliance.
304 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.