Giter Site home page Giter Site logo

Comments (4)

paulpv avatar paulpv commented on June 12, 2024

I run in to this confusion all of the time when working with people that are using my product.
Don't think of airplane mode as anything special to handle.
All the app should care about is "do I have any network connection", which doesn't have much/anything to do with airplane mode.
The app should just watch network connectivity events and only try to connect if there is any network connection (and only warn/toast if there is no network connection).

from onebusaway-android.

paulcwatts avatar paulcwatts commented on June 12, 2024

With this commit, that's essentially what happens. The only difference is the toast message, which will give a hint to the user that they can't connect perhaps because Airplane Mode is on.

Many of OneBusAway's users are relatively tech unsavvy -- the reason why I added that check in the first place is I got a bunch of email complaints that the app wasn't working, only to find out that the user had enabled Airplane Mode.

from onebusaway-android.

paulpv avatar paulpv commented on June 12, 2024

Understood, but you still are treating airplane mode as something special.
I recommend renaming your "isAirplaneMode()" to something like "!isAnyNetworkConnectionAvailable()", and change the method to do just that.
The difference may seem subtle or petty, but can be pretty important.

In my product I have to run as a service and stream audio in the background, so I have to real-time detect this by creating a PhoneStateListener and a BroadcastReceiver for ConnectivityManager.CONNECTIVITY_ACTION that takes action whenever any connection is lost or established.

from onebusaway-android.

paulcwatts avatar paulcwatts commented on June 12, 2024

isAirplaneMode() I think is named correctly, because that's exactly what it does -- it returns true if Airplane Mode is enabled, false otherwise. It seems like "!isAnyNetworkConnectionAvailable" is what isConnected does.

If you'd like to improve OneBusAway's handling of no connectivity situations beyond what I've done, I'd encourage you to file a Pull Request.

from onebusaway-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.