- Home /
quit game if no internet access on android
I have admob ads in my game but i am not earning revenue because the game can be played without internet connection so what i would like is for the game to not run if no internet connection! i have added the users-permission to the manifest and also ticked the require internet box on the build but still the game plays without internet! greatly appreciate some help thank you in advance.
Answer by Bodhid · Oct 02, 2017 at 11:02 AM
if(Application.internetReachability==NetworkReachability.NotReachable)
{
//Display message
//OR
Application.Quit
}
How can i show a pop up to say the game requires internet? not sure of the best way to implement it!
Just to add to Bodhid's answer,
https://docs.unity3d.com/ScriptReference/Application-internetReachability.html You'll have to ping and wait for response to actually learn if device has access to internet.Note: Do not use this property to deter$$anonymous$$e the actual connectivity. $$anonymous$$g. the device can be connected to a hot spot, but not have the actual route to the network.
Your answer
Follow this Question
Related Questions
Admob and GooglePlayGames not working together 1 Answer
AdMob in Editor? 1 Answer
My game crahses when I use it on a phone 0 Answers
Admob ads not showing in the mobile device 2 Answers
Unity Android plugin problem build CommandInvokationFailure 2 Answers