Code Monkey home page Code Monkey logo

Comments (5)

philips77 avatar philips77 commented on June 11, 2024

Hi,
Thank for you issue. This indeed is not intended. As the scanner still works in Oreo+ when using PendingIntent, older systems should behave similarly.

The background task is removed due to this method:

@Override
public void onTaskRemoved(final Intent rootIntent) {
super.onTaskRemoved(rootIntent);
stopSelf();
}

This method of a service is called when you swipe the task. After removing stopSelf(); from there may be two results:

  1. The service doesn't get killed.
  2. The service is killed and immediately recreated with the last Intent (if a proper flag is returned from onServiceStarted(Intent)).

Could you import the lib as a module, remove this method and check?

from android-scanner-compat-library.

fastrde avatar fastrde commented on June 11, 2024

Thank you for your quick response. The removal of stopSelf() does the trick. The service doesn't get killed. I'll check next if the service respond to my BLE Device after hours in the background and let you know.

from android-scanner-compat-library.

fastrde avatar fastrde commented on June 11, 2024

When the phone [Lollipop < affected version < Oreo] enters doze mode announcing devices are not found by the scanner. I think there is nothing that can be done about it (except asking the user for whitelisting), even foreground apps and services are restricted in doze mode.

See https://developer.android.com/training/monitoring-device-state/doze-standby

from android-scanner-compat-library.

philips77 avatar philips77 commented on June 11, 2024

I will address your findings in the new release.

from android-scanner-compat-library.

philips77 avatar philips77 commented on June 11, 2024

stopSelf() removed in 1.3.1.

from android-scanner-compat-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.