Coder Social home page Coder Social logo

Comments (2)

satmandu avatar satmandu commented on July 17, 2024

https://developer.android.com/reference/android/net/ConnectivityManager.NetworkCallback (available in API 21) does provide a mechanism to get info on when the network goes off and on again.

Also FYI activeNetwork.isConnectedOrConnecting used in https://github.com/klinker24/talon-for-twitter-android/blob/master/app/src/main/java/com/klinker/android/twitter_l/utils/Utils.java#L298 is deprecated in API 28, but ConnectivityManager.NetworkCallback might take care of that anyways.

This method was deprecated in API level 28.
Apps should instead use the ConnectivityManager.NetworkCallback API to learn about connectivity changes. ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.NetworkCallback) and ConnectivityManager.registerNetworkCallback(NetworkRequest, PendingIntent). These will give a more accurate picture of the connectivity state of the device and let apps react more easily and quickly to changes.

Thanks for putting up the source for this btw, it is really nice to see how the app is put together, and I'm much happier giving suggestions for an app I'm paying for when I can peek underneath the hood. :)

from talon-for-twitter-android.

satmandu avatar satmandu commented on July 17, 2024

Some example stuff here:
https://android.jlelse.eu/connectivitylivedata-6861b9591bcc

from talon-for-twitter-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.