- Home /
How do I Force Application to Quit if no internet connection available
Can anyone help, i have searched but can't find a solution with Unity.
Android Only Build.
How do I Force my game to Quit if no internet connection available even though its not a server based game. IOS has UI Requires Persistent WiFi , but can't find android equivalent.
In the Player Settings i tried setting "Internet Access set to Require" , but the game still starts and plays with no internet available.
Do i have to do something in the AndroidManifest.xml in my Plugins/Android folder.
Somewhere here maybe : /application>
Can you ping a server then use Application.Quit if the server does not respond?
i also been searching wide and broad for a solutiong with no luck finding an answer.,I also been searching the net with no luck finding it
Answer by Zaeran · Feb 15, 2021 at 05:15 AM
I use Google to test that there's an internet connection, since it's basically always up.
Fire off a UnityWebRequest to https://google.com
If the request has a HTTP error, the internet likely isn't active, and you can call Application.Quit()
Your answer
Follow this Question
Related Questions
What triggers the Internet Access permission, when it's set to auto on Android? 1 Answer
Android game: allow internet for just specific domain 0 Answers
Android: disable/enable internet connectivity! 0 Answers
How do i stop mUnityPlayer.quit() closing the entire android app? 1 Answer
Proper way for Quit Application 2 Answers