Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Weather App Concurrency and Error Handling What To Do When the Network is Down

Jovy Ong
seal-mask
.a{fill-rule:evenodd;}techdegree
Jovy Ong
Front End Web Development Techdegree Student 14,858 Points

Should we use ConnectivityManagerCompat? If so how?

The video teaches us how to use ConnectivityManager to detect if the device has network connectivity. As I was typing, I noticed there is also ConnectivityManagerCompat. Based on the naming of the class, I'm guessing this class is used for backwards compatibility because it has the Compat suffix. Shouldn't we use that one instead? If so, how do we use it here?

1 Answer

Ryan Dsouza
Ryan Dsouza
9,388 Points

Backward compatible packages are all shifted to the support library. They all exist in the following package

import android.support.v4.app.*;

Import the class you need and everything is almost the same