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

Background mode (wakelock?) in the app #5

Open
vit1-irk opened this issue Jun 23, 2019 · 10 comments
Open

Background mode (wakelock?) in the app #5

vit1-irk opened this issue Jun 23, 2019 · 10 comments

Comments

@vit1-irk
Copy link

Please add the optional feature of continuation of the experiment in the background mode.

When making a long-time measurement it can happen that the device is locked (or the screen turned off, or you switch to another app, whatever), and app pauses the experiment. Sometimes it is a trouble to gather the data in such a case.

// BTW, congratulations with F-Droid release, phyphox is great to appear here

@Staacks
Copy link
Member

Staacks commented Jun 25, 2019

Thanks, this is on our todo list, but only as a long-term goal without a specific time at which we plan to start on this task.
The problem here is that the app needs to be split into the user interface part and the data acquisition and analysis part, so the former can run as an activity (Android terminology for a process with visible user interface) and the latter as a service (a process running in the background, typically showing an icon in the notification bar). At the moment, phyphox is an activity (technically speaking it consists of multiple activities) and activities are stopped by the OS as soon as they stop being visible and there is no way around that. Splitting however should be possible (not sure what is actually allowed for a process and what not), but it requires some major restructuring of the app, which is why we have not tackled it yet.

@vit1-irk
Copy link
Author

Also be careful about services.
In the latest Android versions (Oreo and Pie) background services are restricted in the execution time, so it is needed to create a "persistent notification" during the measurement to ensure the service will not stop.

@nakic
Copy link

nakic commented Jul 23, 2021

I was about to use phyphox to collect pavement smoothness data while cycling around collecting street view imagery. I need to have a map on screen to do something like that, which unfortunately kills phyphox, so I have to do without it or find something else that can get it done. Just my 2c.

@Staacks
Copy link
Member

Staacks commented Jul 23, 2021

Please, let us know if you find something. Would be encouraging to see what is actually possible in the background.

@nakic
Copy link

nakic commented Jul 23, 2021

I created a feature request to record accellerometer data in OSMAnd: it seemed a much easier task there than it is here, given the apps' architectures. We'll see what happens.

@Staacks
Copy link
Member

Staacks commented Jul 23, 2021

OSMAnd is the map app in question and you asked them to log sensor data? Seems indeed like the easiest solution if they do that, but it's not the reference case I would have hoped for as their app would be in the foreground. Still, for your case a simple solution, indeed.

@nakic
Copy link

nakic commented Jul 23, 2021

Yup, just trying to be pragmatic. FWIW, there are action cameras (e.g Garmin Virb) which have location and acceleration sensors and produce GPX output with accelerometer data out of the box, so I'd imagine there's already a need for something like that (as marginal as it might be).

It's a drop in the ocean in terms of the kinds of sensing phyphox supports, of course, but given that no progress on background execution was made in 3 years, it seemed reasonable to try the other way. If it's not a priority, it's not a priority: that's fine, but I'm doing what I can to find a solution to the immediate problem.

@Noitarud
Copy link

Noitarud commented Mar 9, 2022

Not sure if limited to tablets,but this android one allows two up in split screen mode, or more with freeform (but one media player can play...).

@lgommans
Copy link

lgommans commented Dec 3, 2022

For reference, the OsmAnd issue is still open and labeled as 'nice-to-have' with no further activity since. osmandapp/OsmAnd#12227

Background data collection in phyphox is also something I would love!

@Staacks
Copy link
Member

Staacks commented Dec 5, 2022

As you bring this to my attention:

The latest version of phyphox has an option to lock the screen when the proximity sensor is triggered.
This is not exactly the same as the request in this issue, but it might help in many situations that would ask for a background mode like recording on a roller coaster with the phone in your pocket. It simply turns off the screen and no longer accepts touch input while still running the app as long as something is close to the proximity sensor (typically next to the speaker of the phone), which would be the case in an pocket.

The nice thing about this is that this is a system feature that is usually used by phone apps, so you do not dial anything with your cheek. Therefore it should work quite reliably on almost all phones without any need for special permissions.

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

5 participants