emericg / WatchFlower

A plant monitoring application that reads and plots data from compatible Bluetooth sensors and thermometers like Xiaomi 'Flower Care' or Parrot 'Flower Power'
https://emeric.io/WatchFlower
GNU General Public License v3.0
192 stars 27 forks source link

Impossible to export data - Android doesn't find any app. #73

Closed Beardmix closed 1 year ago

Beardmix commented 1 year ago

Thanks a lot for this amazing app. It works generally super well and has a lot of great features! I downloaded it mainly to be able to export data, but the functionality doesn't work on my Android phone :/

When I go to settings and click on "Export File" at the bottom, the Android share menu opens with a messages saying that "there are no apps that can handle this action". I think that it is because of the line: Settings.qml#L1672 utilsShare.sendFile(file, "Export file", "text/csv", 0) I think the problem is "text/csv". I tried downloading many CSV apps and File managers but nothing works.

I feel that this could be the answer: https://stackoverflow.com/a/72105124/5539469

If not you could also save the file in the non-protected area of the phone so that a file manager could retrieve it no matter what.

I hope my description is accurate enough and I am willing to test some fixes if you need a tester :D

Thanks again and have a nice day!

emericg commented 1 year ago

Hi, sorry I have not been working on WatchFlower for a while, but I'm planing a release soon.

That's weird, but I guess that could happen. The mime type is already set to text/csv, so I guess the problem is somewhere else. Can I ask what version of Android you are using? On my phone, almost every app installed offer to open this file :/

There used to be an option to save a file on the memory card, but this is a feature that got removed from Android, and ban from the store. I will try to implement a workaround for the next release though.

Beardmix commented 1 year ago

Hi Emeric,

No worries for the time.

I still think that the mime type could be problematic. From the link I sent above:

intent.setType("text/csv"); does not work on regular file explorers, i can pick any file from them. But it does have effect on Dropbox app, which only shows .csv files. How to do same for regular file explorers?

Try intent.setType("text/comma-separated-values")

I think that "text/*" or potentially "text/comma-separated-values" would work better, at least I could save the file in Drive or something. But of course, it would filter fewer apps.

I am running Android 13 and running WatchFlower 4.1.

Unrelated: In the meantime I created my own version of the app but I weirdly get disconnected after a few seconds by the device while I am synchronizing. This problem doesn't appear to happen in your app but I couldn't see what was different in your code. Have you encountered this problem? If so how did you solve it?

emericg commented 1 year ago

I am running Android 13 and running WatchFlower 4.1.

That is most likely the problem, it does require new things related to file handling.

Have you encountered this problem? If so how did you solve it?

Some BLE devices like the Flower Cares times out after a few seconds by design. To stay connected for longer period of time, you need to perform some kind of handshake with the device. While it's not properly documented, you can check my code in the file https://github.com/emericg/WatchFlower/blob/master/src/devices/device_flowercare.cpp

Beardmix commented 1 year ago

Make sense. Thanks for the feedback and pointer to the handshake.

Beardmix commented 1 year ago

Sorry to continue a bit out of thread, but seeing your implementation of the handshake it seems that it works only on Android, as the BLE MAC address is necessary. How can it work with the ID that iOS returns instead of the device MAC?

emericg commented 1 year ago

Sorry to continue a bit out of thread

No problem. You really need the MAC, the UUID that iOS gives you is completely random. Thankfully the FlowerCare broadcast their MAC in their service data, as you can see in this doc https://github.com/emericg/WatchFlower/blob/master/docs/mibeacon-ble-api.md

Beardmix commented 1 year ago

Great news! Thanks for the pointer, I'll check that.

If you do an update for the files handling for Android 13, let me know if I should test something to see if the fix work.

emericg commented 1 year ago

Can you maybe try the latest version on the play store (the 5.0) and check if anything changed regarding your issue?

Beardmix commented 1 year ago

It works like a charm 👍 Good work!

On Mon, 27 Mar 2023, 19:31 Emeric, @.***> wrote:

Can you maybe try the latest version on the play store (the 5.0) and check if anything changed regarding your issue?

— Reply to this email directly, view it on GitHub https://github.com/emericg/WatchFlower/issues/73#issuecomment-1485551764, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABBY5MZEMPPSG6LIX6IXUATW6HFF3ANCNFSM6AAAAAAQQA2EGE . You are receiving this because you authored the thread.Message ID: @.***>

emericg commented 1 year ago

Alright that's great news! Closing this issue.