Hai i am new bie to Android. i need to check the network connection throughout the application and inform to user about the network status when the state changed.please tell me how to do with some sample code.thanks in advance
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
runOnUiThreadandConnectivityManagerfor checking Network Status after a fixed time and show message to user as:and second option without using Thread then you can register an receiver for
CONNECTIVITY_CHANGEManifest.xml as:in code: