1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

Android "push-notification" and possibility to run game in background [GMS 2]

Discussion in 'Programming' started by c0dycZ, Mar 31, 2019.

  1. c0dycZ

    c0dycZ Member

    Joined:
    Mar 31, 2019
    Posts:
    2
    Hi, 2 questions from a beginner to get to know if GMS 2 is the right IDE for my Android-Game idea.

    I want to make a game that can send push-notifications to the smartphone if the attention of the player is required for a specific action. Therefore a found push_local_notification() in the helpfile.

    My first problem is that the helpfile uses var fireTime = date_inc_day(date_current_datetime(), 1);
    to set the day and time to appear, but how should i write it to appear at same day with a specific time of day?

    My second, bigger problem i think, is that some processes of the game should still run in the background if the game is not in foreground or the smartphone is locked while game is running. (To call specific event in the game if the user didn't pay attention for a while)

    Is there a switch or variable in GMS 2 to deactivate the automatic pause of the game when user lock the smartphone or minimize the app?

    Thanks for every help!
    Greets, Chris
     
  2. iam1me

    iam1me Member

    Joined:
    Mar 30, 2019
    Posts:
    20
    It's been a little while since I've messed with Android development, but I'm pretty sure that to solve #2 you are going to need to create a background service - which I wouldn't expect GMS2 to be directly capable of (since GMS is designed to be single-threaded). However, you might be able to get around this via native coding.

    EDIT: Alternatively, try recording and checking the time span between iterations of your main loop. You can adjust your actions based upon the amount of time that has passed.
     
  3. c0dycZ

    c0dycZ Member

    Joined:
    Mar 31, 2019
    Posts:
    2
    hi, thxs for you reply!

    The idea with work off the actions by passed time was my alternative, too. But i have concerns that in worst case the user is inactive for few days and the actions may take to long to proceed or even are not good to realize. But i will give it a try if anyone hasn't a good alternative. ;)
     

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