App Redirects to wrong page and UI breaks if app is closed and opened again

I have ionic-6 cordova app. It builds(debug build) with no errors and runs.

But whenever I close the app from app trey or Force Stop it from system settings and open it again, it redirects me to the contacts page and the page UI appears to be broken.

I have below routes in my app-routing.module.ts file:

const routes: Routes = [
    {
        path: '',
        redirectTo: condition == true ? 'home' : 'signin',
        pathMatch: 'full',
    },
    {
        path: 'signin',
        loadChildren: () =>
            import('./signin/signin.module').then((m) => m.SigninPageModule),
    },
    {
        path: 'home',
        loadChildren: () =>
            import('./home/home.module').then((m) => m.HomePageModule),
    },
    {
        path: 'contacts',
        loadChildren: () =>
            import('./contacts/contacts.module').then((m) => m.ContactsPageModule),
    },
];

Broken UI: The footer does not sticks to the bottom and covers the main content.

App was tested on below android versions:

  • Android 12
  • Android 8.1

Ionic Info

Ionic:

   Ionic CLI                     : 6.19.0 (C:\Users\CGauns\AppData\Roaming\nvm\v16.15.0\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 6.1.10
   @angular-devkit/build-angular : 13.2.6
   @angular-devkit/schematics    : 13.2.6
   @angular/cli                  : 13.2.6
   @ionic/angular-toolkit        : 6.1.0

Cordova:

   Cordova CLI       : 11.0.0
   Cordova Platforms : android 11.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 19 other plugins)

Utility:

   cordova-res                          : 0.15.4
   native-run (update available: 1.6.0) : 1.5.0

System:

   Android SDK Tools : 26.1.1 (D:\Android\sdk)
   NodeJS            : v16.15.0 (C:\Program Files\nodejs\node.exe)
   npm               : 8.5.5
   OS                : Windows 10

Please show the html portion

hi @Hills90210 for some reason, I am not able to replicate the issue :neutral_face:. Earlier it used to come every time I close and open the app. Now the UI is shown properly.

But when the app is opened, it still shows the contacts page. How to rectify this issue? Also in the address bar of dev tools, the URL is shown as localhost/

Let me know if you need anything?

It could also be another error that occurs during runtime, for example due to a plugin. You should debug your app with --livereload while testing it on your device.