i am working on an image gallery app, in which application is retrieving images from internet.
so i want to prompt a dialog-box to ask user to connect to internet or quit application.
show user both WiFi and Carrier network option.
i am working on an image gallery app, in which application is retrieving images from internet.
so i want to prompt a dialog-box to ask user to connect to internet or quit application.
show user both WiFi and Carrier network option.
this checks for both wifi and mobile data..run tis code on splash or your main activity to check network connection.popup the dialog if the net is not connected and finish the activity.It's that simple
First you should check if they are already connected or not (tons of examples how to do this online)
If not, then use this code
This is the way it is done.
This class checks for a valid internet connection:
The following method opens the wi-fi panel if there is no valid internet connection:
The following method opens the 3G panel if there is no valid internet connection:
Hope this helps :)
Try this: