I want that my game automatically does a restart in some situations. How can I do this in my Update method on iOS and Android?
You can launch an app from another app. I’ve seen this used in the context of “hey, play this other game I’ve developed, click here to launch the installed app”, as an example. You could probably sort this out so that your main app launched the updater, which closed your main app and updated, then launched the main app again. I think the preference is that you do this through the store, but I don’t see any reason why you couldn’t go about it this way if you were so inclined.
Having said that, there’s a few caveats on each platform…
- On Android, you can go ahead and just do this. I think you need some kind of OS level permission, but it’s no different than requesting file access and is pretty straight forward. I think you just do it by starting an activity with the package name.
- On iOS, you can’t directly launch another app/process and have to do it via a launch link. Your app then has to know how to interpret this launch link in some way.
It’s been a while since I looked at the specifics, but that should help you with some things to google Good luck!
I have read that a game gets rejected in the app stores if the game restarts in some situations. I will try to solve my problem without restarting the game.