Prabhu
Prabhu

Reputation: 13355

Ionic Android app getting black screen after startup

Since I upgraded to the latest beta 14 version of Ionic, I am seeing some weird behavior when the app starts. App loads up fine the first time, but after a few hours or not using it, it blanks out when I try to bring up the app again.

After doing some research, I realized this problem may have been because my main state had only an ion-nav-view element and nothing else:

<ion-nav-view name="homeContent"></ion-nav-view>

After adding an empty ion-view tag to the page <ion-view></ion-view> as one user had suggested, the screen is not blacking out as often, but it's still doing it every now and then.

Everything works fine when testing on the browser.

Wondering if it's trying to load the view when the app starts and it somehow is not able to load it. I can see the screen "blinking" for a moment and then going to a black screen. And if I just close and reopen the app again, it sometimes loads up the UI normally.

I also noticed that the screen going blank thing happens usually a few hours after I last used the app.

Spent a lot of hours creating a nice app, but can't release it to the play store if it's not going to open up consistently. Any help to hunt the issue down would be appreciated.

All of this happens only with the latest build. If I load up one of my older apks, things work normally.

Upvotes: 3

Views: 4894

Answers (1)

mfink
mfink

Reputation: 1380

Not sure exactly, but the resources needed to display may not be there yet. Perhaps adding a splash screen initially could buy you the expense of a flickering load? One simple way being someing like here:

app.run(function($cordovaSplashscreen, $timeout) {
    $timeout(function() {
        $cordovaSplashscreen.hide()
    }, 5000)
})

Cordova Splash screen plugin here

Upvotes: 2

Related Questions