Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Run code when updated without opening the app

Discussion in 'Android' started by Martho42, Jul 6, 2021.

  1. Martho42

    Martho42

    Joined:
    Oct 1, 2015
    Posts:
    14
    So my game is installed on more than 10,000 devices, but there seems to be no way to let users know when I push an update. Google play will update the game automatically, but my users don't know it's been updated unless they open the app. Analytics show me that very few of my old users who still have the app installed know that I've updated it. Is there any way to run some code when the app is installed/updated? Or, if there was a way to make the app open itself/run some code in the background on a regular schedule, that would work too. If I could do either of these, then I could set up a push notification to alert users.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. Martho42

    Martho42

    Joined:
    Oct 1, 2015
    Posts:
    14
    @JeffDUnity3D That's not what I'm asking. I'm trying to find a way to do it without requiring the user to open the app
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Have you seen other apps do this? Where do you receive the notification? You said "run some code", what code would you be running? You might allow users to sign up for email updates.
     
  5. Martho42

    Martho42

    Joined:
    Oct 1, 2015
    Posts:
    14
    It would be a push notification. Plenty of apps send a push notification when there is new content. This is a very standard way for android users to get notifications from their apps. The code to run would be a few lines to schedule a push notification, e.g. what you find here: https://docs.unity3d.com/Packages/com.unity.mobile.notifications@1.4/manual/Android.html

    The closest solution I've found so far is this: https://github.com/nintendaii/unity-background-service
    I'd need to find a way to make the service run for a couple seconds every day on a schedule to see if the app has been updated, and if so, make a push notification.
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes I'm familiar with notifications. Personally I've never seen one that mentioned a new version is available, but up to you. I suspect you would need user permission to do so, and you would need to install the service if Google allows.
     
  7. Martho42

    Martho42

    Joined:
    Oct 1, 2015
    Posts:
    14
    Yeah, I probably wouldn't phrase it that way. "New levels available" or something. I suspect there should be a relatively simple way of doing this since there are plenty of apps that give non-scheduled notifications based on outside factors; e.g, any messaging app will tell you when someone replies to your message (these usually put a number on the app instead of a push notification, but I'd be fine with that too). Thanks for the tip on user permission and installation
     
  8. Akzamutdinov

    Akzamutdinov

    Joined:
    Jan 4, 2021
    Posts:
    6
    Did you find a solution? My case is that I have a lot of devices with my app installed, however not a lot of them are really active. I've been uploaded app update and I want users who are not using app for a while to come back and open app again. I do understand that to run any code within app, it has to be opened... but probably there is any way to do that?
     
  9. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,858
    Won't push notification solve this?