android check if mobile network is ckecked in setting or not -
i know if mobile flag in setting checked or not.
with threads can check if 3g connected or not can not see if checkbox enable enabled or not in setting
how check if wifi/3g enabled? google android - how figure out if 3g , 2g turned on android: how check whether 3g enabled or not?
how can check this?
this function homecoming true if net connection available else homecoming false.
public boolean getconnection() { connectivitymanager manager = (connectivitymanager) getsystemservice(connectivity_service); boolean is3g = manager.getnetworkinfo( connectivitymanager.type_mobile) .isconnectedorconnecting(); boolean iswifi = manager.getnetworkinfo( connectivitymanager.type_wifi) .isconnectedorconnecting(); log.v("",is3g + " connectivitymanager test " + iswifi); if (!is3g && !iswifi) { toast.maketext(getapplicationcontext(),"your net connction off",toast.length_long).show(); homecoming false; } else { toast.maketext(login.this, "connected",toast.length_long).show(); homecoming true; } }
if not satisfy above reply can utilize try-catch. if not receive info means connection has problem.
android
No comments:
Post a Comment