Android Black screen after purchase an item.

Discussion in 'Programming' started by LucasLima92, Mar 17, 2019.

  1. LucasLima92

    LucasLima92 Member

    Joined:
    Jan 31, 2017
    Posts:
    7
    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.
     
  2. LucasLima92

    LucasLima92 Member

    Joined:
    Jan 31, 2017
    Posts:
    7
    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?
     
  3. LucasLima92

    LucasLima92 Member

    Joined:
    Jan 31, 2017
    Posts:
    7
    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
     
  4. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    1,955
    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.
     
  5. Pfap

    Pfap Member

    Joined:
    Apr 30, 2017
    Posts:
    440
    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.
     
  6. LucasLima92

    LucasLima92 Member

    Joined:
    Jan 31, 2017
    Posts:
    7
    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.
     
  7. Pfap

    Pfap Member

    Joined:
    Apr 30, 2017
    Posts:
    440
    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.
     
  8. LucasLima92

    LucasLima92 Member

    Joined:
    Jan 31, 2017
    Posts:
    7
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice