I'm developing a simple app that requires network connectivity to function. When the app starts, and if there is no wi-fi connection, I want to display a modal dialog to the user with two options: 1) Enable wifi or 2) Quit the application.
The problem is that I can't find an android method that can be called to close the application if the 'close app' button is clicked.
Is there such a method that I haven't found yet? Or is there some better way to handle this entire use case?
You should think about the Quit Opinion,
here is an good Answer about Quiting an App SO Answer
You can say that no WiFi is present.
And if you just make an AlerDialog like this:
Or a Toast like:
If you whant to check for an connection, you can use this snippet: