xamarin.ios - Show alert about internet connectivity before launching the application (Monotouch) -


i developing app requires internet connection, want check availability before launch. if internet connection not available, show alert user , go home instead of trying launch app.

so used reachability class, recommended here (http://stackoverflow.com/questions/1961341/check-for-internet-access-with-monotouch) check internet connection. far good. if place check in main.cs, performs check, not display alert.

if(!reachability.ishostreachable("http://google.com")) {                 debug.writeline("offline");                 uialertview alert = new uialertview("offline","voor deze app een internetverbinding vereist.",null,"ok",null);                 alert.show();             }             else{                        mpframework.application app = new mpframework.application();             uiapplication.main (args, null, "appdelegate");                      } 

if place check in appdelegate.cs performs check, displays alert, keeps black screen instead of returning home. place code in order check before launching app, , displaying alert?

you're looking @ bit wrong:

  • apple doesn't approve of apps kill/close (see this: https://stackoverflow.com/a/356342/183422). if user wants close app, should himself.

  • you need main loop running show ui - , main loop started when call uiapplication.main (which why have check in appdelegate.cs , show corresponding alert there instead of in main method).

so, putting these things together, think should show blank/splash screen, check reachability , if there none show alert (and if user dismisses alert, maybe check again).


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -