Git Product home page Git Product logo

Comments (5)

davidgyoung avatar davidgyoung commented on August 20, 2024

Good catch. The issue is that the serviceMessenger is not set to null when the service disconnects, so the isBound() method returns the wrong value.

Fixed in beecedf

from android-beacon-library.

sjones512 avatar sjones512 commented on August 20, 2024

It sounds like onServiceDisconnected may only be called in the event of the service crashing. I cloned the latest commit and it does not seem to be called when I go through the normal unbinding process.

It seems like an alternate solution will be necessary.

from android-beacon-library.

davidgyoung avatar davidgyoung commented on August 20, 2024

If there is no callback in the service when the last consumer unbinds, then I suppose it would be possible to track it simply by the number of consumers. Perhaps in the unbind method, we could simply change:

consumers.remove(consumer);

to

consumers.remove(consumer);
if (consumers.size() == 0) {
    // If this is the last consumer to disconnect, the service will exit
    // release the serviceMessenger.
    serviceMessenger = null;
}

@sjones512, since you clearly have a test case queued up, do you want to give this a try?

from android-beacon-library.

sjones512 avatar sjones512 commented on August 20, 2024

This appears to work. The next time getInstanceForApplication is called in onCreate the serviceMessenger is null and isBound returns False.

from android-beacon-library.

davidgyoung avatar davidgyoung commented on August 20, 2024

Changed in 2b0d4ed

from android-beacon-library.

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.