systers / malaria-app-android

A mobile app that will aid the Volunteer in sustaining life-saving malaria prevention tactics over their 2+ years of service.
25 stars 110 forks source link

White Screen on startup for few seconds. #204

Closed harshitagupta30 closed 7 years ago

harshitagupta30 commented 7 years ago

On startup just after installation, a white screen appears for approx 5 seconds and then the main screen appears. screenshot_2017-01-13-22-29-03

@yatna and @chhavip please review the issue and let me know.

anubhakushwaha commented 7 years ago

@harshitagupta30 Before you try to fix it,can you identify the cause behind it and how you are planning to resolve it?

harshitagupta30 commented 7 years ago

@anubhakushwaha That is happening because of the android's cold start. If we are running any type of processing code in our splash screen, all your processing code will run before the screen draws its components in Android so the white screen appears for few seconds. But when I checked the app on the other devices it's working absolutely fine. That's an issue with zenfone2. So, I guess you can close this issue. :)

codingblazer commented 7 years ago

@anubhakushwaha Its happening on other devices too. I checked on Moto X style nd Nexus 5. Maybe we can put it on hold until someone find the root cause for this.

anubhakushwaha commented 7 years ago

In order to avoid hiccups and visually respond as soon as possible to the user interaction, the system displays a temporary window: the “starting window” also known as the “preview window” which is white by default.There are pretty many ways methods to resolve this,further I hope after resolving #42 we will have less resources to preload . @harshitagupta30 @codingblazer Incase you want to work upon it let us know :)

harshitagupta30 commented 7 years ago

@anubhakushwaha Hi, I am willing to work on this issue :)

anubhakushwaha commented 7 years ago

Go ahead and let us know the best solution you can implement :+1:

ashu-dadhich commented 7 years ago

@anubhakushwaha I have a way around for this. Since nearly every app except you-tube shows white screen on its start up. We can implement the same method what you-tube is using. I am uploading a working solution if you like it then I can send a PR. myimage

harshitagupta30 commented 7 years ago

@anubhakushwaha If we add "true" in the current theme which is AppTheme in style.xml we can resolve this issue changing the way it looks. I cross checked on 4 devices with different android version and its working absolutely fine. Since the initial screen we see known as Preview screen if we disable it we can get desired output.

Can I send the PR for this? :)

codingblazer commented 7 years ago

@anubhakushwaha The solutions mentioned above are good but they just hides the white screen but not actually reduce startup time. If you say, we can combine these solutions (I can reduce startup time and @harshitagupta30 can add theme) which will be best solution.

anubhakushwaha commented 7 years ago

@codingblazer How are you planning to reduce the startup time? and @harshitagupta30 please attach a gif of your implemented work.

harshitagupta30 commented 7 years ago

@anubhakushwaha Check this out :) videotogif_2017 01 26_22 39 44

m-murad commented 7 years ago

@harshitagupta30 I think what you have done is that you have disabled the preview window. If so the drawback is that app will take more time to start. The time for which user has to wait for the launcher activity to draw on the screen will remain the same.

or If you have used some other approach please tell.

harshitagupta30 commented 7 years ago

@free4murad yeah I have done that thing only. I don't think its increasing any significant amount of time during startup.

m-murad commented 7 years ago

@harshitagupta30 I never said it increase the launch time it keeps it the same.

harshitagupta30 commented 7 years ago

@free4murad but in above comment you mentioned that "the drawback is that app will take more time to start" but I couldn't find that happening.

m-murad commented 7 years ago

@harshitagupta30 Oh sorry, made a mistake. My bad.

harshitagupta30 commented 7 years ago

@free4murad No issues. Have you faced this issue while using disabled the preview window?

m-murad commented 7 years ago

@harshitagupta30 Actually I was working on some other app sometime back and was facing the same problem.

I think the slow load is because of the complex and big UserMedicineSettingsFragmentActivity.

Also UserMedicineSettingsFragmentActivity has some memory leak as reported in issue #188 (It might also be responsible for the slow load).

Also if we add a welcome screen in the app (issue #115 ) this will be solved.

harshitagupta30 commented 7 years ago

@free4murad Yeah I also have the same views! :+1: @anubhakushwaha Whats your opinion? :)

codingblazer commented 7 years ago

@anubhakushwaha I will be doing the profiling of the app using adb to measure the actual time for the cold startup. After this i will use the tools like Method tracer and inline tracing to identify the bottlenecks causing this problem and solve them. After this i will look for some common issues like memory leak, heavy initialization in onCreate(), global objects etc

anubhakushwaha commented 7 years ago

@harshitagupta30 @free4murad @top-gun007 @codingblazer For the time being we can put this on a hold and would proceed with it as per the progress of #115