Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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

Jovy Ong
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