Best practices to live in Sailjail

Hey,

I’ve been developing a SFOS app for a few years now. Now it’s time to make it live and operate well under Sailjail. I assumed it’s possible to use Sensors and HomeDir permissions to poll sensors and save stuff into a text file and place it in the home dir, but that way my app is not accepted in the Harbour. What’s the best practice to poll sensors (like accelerometer) under Sailjail? Do I need to ask for Location permissions and that will cover all sensors too?

What’s the best way to save the information displayed in my app into a text file? Or more specifically, under Sailjail what’s the proper directory to place such an output? Downloads? Documents? Somewhere else? And to write into that dir what permission do I need to ask for?

Thank you in advance!

Tamas

1 Like

There it’s mentioned that ‘sensors’ as a whole is discouraged. I’m not sure which sensors your after, but I’d try something like really open perms and removing them build for build to test:

[X-Sailjail]
OrganizationName=org.test
ApplicationName=test
Permissions=Compatibility;Camera;Audio;Microphone;Location;NFC;RemovableMedia;UserDirs

I think Location get’s you compass/gyro …

1 Like

Thank you for your reply! I’m after all sensors available in the device since my app is for hardware+software diagnostics. My only issue using Location is that it may suggest users that my app actually uses location (GPS), but it’s actually not the case.

1 Like

Is that a file the user would need/want to see? Then place it in either of those two and use the corresponding permission of the same name (or the catch-all UserDirs).

If it’s just an internal temporary file, use ~/.cache or /tmp, or rather StandardPaths.cache or StandardPaths.temporary.

I just checked the irc logs to refresh my memory:
https://irclogs.sailfishos.org/meetings/sailfishos-meeting/2022/sailfishos-meeting.2022-04-14-07.00.txt

It seems the fix in grouping the sensors permissions will involve location:

  * <Jolla> However, since this is needed, we now have a PR to add the
    Sensor permission to the Location permission group.  (flypig,
    07:30:50)

I agree with you that this will be misleading, but it’s a start :slight_smile:

I have one case where I need to write a temporary file out (.ical) which needs to be picked up by an second app (calendar) and I just write those to Documents. On application start, I clean out old files of the type matching a name pattern.