Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android check connection without context

i would like to know if it's possible check connectivity in android without having a Context, because the thread i have running in background doesn't know the context. if there's no way, is a best practice passing to the thread the context?

thanks

like image 336
Gerardo Avatar asked Oct 15 '22 09:10

Gerardo


1 Answers

Yes, you need the Context. Possibly, your thread will already have access to a Context, courtesy of the Runnable it uses being an inner class of the Activity or Service that forked the thread.

like image 199
CommonsWare Avatar answered Oct 20 '22 10:10

CommonsWare