• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Black screen after purchase an item.

Hello! Anyone have a problem after buy a product in app like this:
When I buy an iten, after google validation, the screen goes black, and have a big delay to return to game, like an 5 or more seconds. Thanks.
 
I can see the problem here:
03-17 12:50:04.068 18521 18521 I yoyo : BILLING: Consumed => { "productId":"x25_coin", "token":"token-removed-by-me", "consumed":"true", "response":0 }
(here the black screen)
03-17 12:50:12.904 18521 18535 I yoyo : BILLING(R): Product x25_coin has been consumed

after 8 seconds the game have consumed the product. How to solve this delay? Is my internet connection the problem? Have a way to do not black screen?
 
I discover it's not only after purchase a product. This happens too after push lock button on android, and return to game. All my room sizes are in 1080x1920
 
Not sure, but because you said you also get the delay when pressing the lock button, I would try making your room size a lot smaller and testing your game.

1920x1080 is pretty big for mobile (although I would say not massive these days given the performance of current phones).

Perhaps the delay is caused by the game having to restore the application surface and other textures.
 

Pfap

Member
Just to chime in on what @IndianaBones mentioned. While testing on mobile I recently learned that a battery is running low message also causes any code in an if os_is_paused() block to be run. I was testing with the thought that code in the aforementioned block would only run if pushed to the background, and got some unexpected behavior.
 
1920x1080 is pretty big for mobile (although I would say not massive these days given the performance of current phones).
Thanks. In phones with better hardwares this delay stay about 1 or 2 seconds. Like in Moto X4. My phone is a Moto G3. This is strange because other game maker games on play store like https://play.google.com/store/apps/dev?id=7705235751403622974 with a good graphics don't have these delay.

Just to chime in on what @IndianaBones mentioned. While testing on mobile I recently learned that a battery is running low message also causes any code in an if os_is_paused() block to be run. I was testing with the thought that code in the aforementioned block would only run if pushed to the background, and got some unexpected behavior.
I'll try this code. But after a purchase what can I do? :( Thanks.
 

Pfap

Member
Thanks. In phones with better hardwares this delay stay about 1 or 2 seconds. Like in Moto X4. My phone is a Moto G3. This is strange because other game maker games on play store like https://play.google.com/store/apps/dev?id=7705235751403622974 with a good graphics don't have these delay.


I'll try this code. But after a purchase what can I do? :( Thanks.
The code I posted won't actually solve your issue. You will need to find out what goes wrong when the device pushes your game to the background. It could be a surface is lost or buffers, basically anything in memory will be lost when the device takes over. @IndianaBones mentioned the application surface and textures... one thing you could do if it loads in a normal playthrough without losing focus, is that when your game returns to the foreground send them to a smaller room with a loading animation and then get your main game set up.

Edit:
Here is some code you could use for that... not sure if it would be jarring for the user experience though.

Code:
if os_type == os_ios || os_type == os_android{
 if os_is_paused(){
  /*
You would save any data you need to here and then in 
the alarm that is started below you would have the player 
be sent to a room that is smaller and loads faster while you get
the rest of your content set up
*/
alarm[0] = 60;//in this alarm room_goto(loading_room);
 
 }
}
Again I'm not sure this will work, but you could play around with it and maybe find a solution.
 
Yeah! My problem really is the size of the texture pages. If i put the size in 256x256 just to test, the game has no black screens, if i put 1024x1024 the game has a microsecond of time a black screen, if i put 2048x2048 the game has a one second of black screen and successively...

Thanks, I'll stay on 2048x2048, it's a good one, and not appears locked.
 
Top