Android: how to close app if no Internet connection available? -
i developing game on android, , requires internet connection played. know how check whether connection available or not, not sure in case connection not available.
my idea display "no connection available" dialog user, "exit' button right below it, can close app dialog , fix connection. doing system.exit(0) command.
however i've read in many places shouldn't use command or close app, , instead let os handle this.
but how can solve situation without using system.exit(0)?
i believe drawsomething game checks internet connection , presents "exit" button in case don't have one. not sure method using close app though.
but how can solve situation without using system.exit(0)?
check internet connection in first activity, , call finish() rid of activity if there no internet connection (or, more accurately, after user clicks on confirmation dialog).
Comments
Post a Comment