App Loading Problem

Android. Main.lua sets a few variables, generates a db3 database, and eventually sends the user to a login.lua. Works perfectly fine the 2nd time the user starts the app… works perfectly fine in the simulator. I haven’t yet developed on iOS to compare. I’m not sure where the storage popup comes from. I think it’s from Android itself based on my permissions listed build.settings. I’ve put no code at all in for the popup, though I am currently trying… but that’s a whole other long story.

Does the Corona start screen show up? I have actually never seen this. On my cuadros app it was taking a long time connecting and pulling things down but I have staggered them. Even when it took a while if you waited long enough it would display the game. Do you wait for the event that the app has started?

https://play.google.com/store/apps/details?id=com.zantics.games.zanticsracing

I truly appreciate your help on this. It might be beneficial for you to experience the issue first hand if you have an Android device. I once waited for almost 10 minutes… I think my issue is different than yours. Since it happens right after the app is updated too, I’m really struggling with this one.

Are you testing on device before you release?

Are you watching “adb logcat” or the console log in Android Studio to see what messages are happening on the device?

It sounds like you have a bug when your app runs the first time. I’ve seen this a lot even with my apps if I change something in my settings and don’t properly check my loaded settings and some value I’m expecting to be in the settings is nil.  You won’t know anything until you look at your device’s console log for errors.

Rob

I haven’t yet, but am working on getting adb logcat working.

I am testing on device… and I saw this issue prior to release… but it was intermittent, so I mistakenly ignored it and now it has increased in occurrence.  I thinking back… before I took it to Alpha/Beta on Google Play, I never had this issue.  I was creating a Single .apk and moving to the device directly for installation.  However, my app is over 350MB, so for Google Play I had to use Expansion files by simply using the usesExpansionFile = true feature in build.settings. That’s when the problem first started. I’m starting to think this issue might be related to that.

Is anyone using the Expansion File feature and not had this problem?

I tried on a couple of my devices (LG V10 and ZTE LTE Tablet). In both cases it worked without a problem. On the ZTE tablet I deleted and downloaded it multiple times. No issue.

Thanks for checking it our agramonte… That’s where the intermittent problem comes in… I wonder if it’s device specific.  I’ve seen the issue on a Galaxy S8+ and and Galaxy S9+ personally.  

Rob, I think you were right.  I seems as though it was a sequence thing related to the user giving Permissions.  I placed the startup function in a cycle that checked every 1 second for the user to give permission, and the app loading issue seems to have disappeared.  

Thanks for the help everyone.

So after troubleshooting my ongoing Onboarding issue some more, I think there might be more here than meets the eye.  In troubleshooting it, I had moved the code to the top of my main.lua file and placed it outside of a function where I originally had it.  This still didn’t fix the onboarding issue, but it did seem to fix the App Loading Issue.  In continuing to troubleshoot my Onboarding issue, I placed the Onboarding API back into a function and then called it immediately… I did this so I could could call it again later.  This still didn’t fix my Onboarding issue, but appeared to fix my App Loading Problem.  The two issues appear to be related.  I’m using “useExpansionFile =  true” because my app is 350 MB.  I believe this is causing Android to automatically throwing up a Permission message for “Storage” to the user instead of using my custom Corona PopUp API.  Therefore, it’s reacting to the user input of deny or allow in its own way instead of the API.  When this happens, it appears as though it won’t allow functions to be called… but will run code in Main.lua that is outside of functions.  If I’m right… I believe this might be a bug in Corona.

Has anyone else ever experienced anything like this?

yes…it is a problem that has existed in corona builds for ages and ages…and no one seems to bother.

As mentioned in many other places the only solution is tell user to manually allow storage BEFORE launching app, or make the user allow then close and relaunch the app…groan…

I read this thread and I’m not clear what the problem is.
 
1. Is this the recipe to reproduce?
A. User has the app installed,
B. User downloads and auto-installs update to app from Google Play store.
C. User tries to run app, but it hangs the first time on black screen.
D. Subsequent runs 2, 3, … run fine.
 
2. What are you doing when the app loads?
It sounds like you’re doing a lot of heavy lifting when the app loads.  Also, if you’re modifying and/or reading existing files are you sure you don’t have a bug in your code?
 
I see this all the time.  Users update an existing game/app that stored some settings, but add a new field in the update.  Then, when existing users get the update and run the app, the updated version loads the saved settings file from version 1 and (of course) cannot find the new field.  This then crashes the game/app or causes other issues.
 
The trick here is to always assume all fields in your settings (JSON encoded tables) files will be non-present and if they are not present supply a default value before using the field.  Also, re-save the settings file after you ‘massage’ it and set defaults.
 
3. I haven’t seen any logcat logs or notes yet, but maybe I missed that.

4. You mentioned storage permissions and expansion files, but I’m not 100% clear on how these tie in to the reproduction recipe.

Can you clarify: 

A. Did the app always require the ‘permissions’ you mention?  I ask because it is weird that they need to be OKd a second time for an existing install.

B. Are you seeing this for existing users who had and old version w/o expansion files, then updated and needed expansion files for the new version?

Sorry for the 20 questions. :frowning:

Hopefully I’m not muddying the water, but this sounds like the same issue:

https://forums.coronalabs.com/topic/71102-expansion-file-blank-screen/

What version of Android are you testing on?

This sounds like both a major issue (thanks to Android changes) and something that might be a challenge to fix since it may mean changing how and when permissions are requested and applied relative to the app launch.

Another solution is download additional content from a server on first load and this will keep your APK under 100MB and not require using expansion files.  

Sure you may have some minor hosting costs but this is better and unhappy customers.

You can get GBs of space from Google for a few $ so maybe an avenue worth exploring?

This is how most large games handle the 100MB barrier.

Mods, can we ban this ‘user’? It’s clearly a bot.

@nick_sherman, done.

Rob

Nice one.

Although now it looks like I was talking about SGS :slight_smile: