Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShakeDetion should work in background #52

Closed
pratikbutani opened this issue Dec 9, 2019 · 4 comments
Closed

ShakeDetion should work in background #52

pratikbutani opened this issue Dec 9, 2019 · 4 comments

Comments

@pratikbutani
Copy link

Do you want to request a feature or report a bug?
Feature

What is the current behavior?
ShakeDetection is working when app is open. I want it even though app is killed.

If the current behavior is a bug, please provide the steps to reproduce.

Any logs, error output, bugreport etc?

What is the expected behavior?

Any other comments?
Please help to work with Shake Sensor in Background too.

What versions of software are you using?

  • Device Information:
    Samsund Galext J8

  • Android Version:
    Android 9.0

@nisrulz
Copy link
Owner

nisrulz commented Dec 9, 2019

This can not be done anymore, from Android 9 onwards.

Read more: https://developer.android.com/about/versions/pie/android-9.0-changes-all#bg-sensor-access

@pratikbutani
Copy link
Author

There is also written like:

If your app needs to detect sensor events on devices running Android 9, use a foreground service.

@nisrulz
Copy link
Owner

nisrulz commented Dec 12, 2019

True, but that is not an implementation I see being bundled in the library. Activity/Services are not supposed to be bundled. They are a client side implementation. The goal of Sensey has always been to be able to simplify detection of Gestures, how and where it is needs to be detected is an app developer decision.

Why is that the case? Because these things change and putting it inside the library means that the library will be outdated when Android decided to make that change. For instance Sensor data was readable earlier in background but not anymore. If I had implemented that change of bundling a Service to handle this, I would have to handle changes across API versions. This is what I would not like to do.

The idea is to abstract the hard part. Putting the listener inside a Service in foreground or in a job for WorkManager is normal Android development, figuring out the algorithm to detect a particular gesture is not. This is why Sensey has always focused on that part, making sure the gesture detection is simplified.

@pratikbutani
Copy link
Author

Yeah, you are right. This is really great library.

Thank you @nisrulz for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants