{"action":"created","issue":{"url":"https://api.github.com/repos/Freeyourgadget/Gadgetbridge/issues/153","labels_url":"https://api.github.com/repos/Freeyourgadget/Gadgetbridge/issues/153/labels{/name}","comments_url":"https://api.github.com/repos/Freeyourgadget/Gadgetbridge/issues/153/comments","events_url":"https://api.github.com/repos/Freeyourgadget/Gadgetbridge/issues/153/events","html_url":"https://github.com/Freeyourgadget/Gadgetbridge/issues/153","id":113434875,"number":153,"title":"Permission error, can't export DB and no debug log created","user":{"login":"simonvanderveldt","id":204286,"avatar_url":"https://avatars.githubusercontent.com/u/204286?v=3","gravatar_id":"","url":"https://api.github.com/users/simonvanderveldt","html_url":"https://github.com/simonvanderveldt","followers_url":"https://api.github.com/users/simonvanderveldt/followers","following_url":"https://api.github.com/users/simonvanderveldt/following{/other_user}","gists_url":"https://api.github.com/users/simonvanderveldt/gists{/gist_id}","starred_url":"https://api.github.com/users/simonvanderveldt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonvanderveldt/subscriptions","organizations_url":"https://api.github.com/users/simonvanderveldt/orgs","repos_url":"https://api.github.com/users/simonvanderveldt/repos","events_url":"https://api.github.com/users/simonvanderveldt/events{/privacy}","received_events_url":"https://api.github.com/users/simonvanderveldt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-26T19:38:50Z","updated_at":"2015-10-27T21:20:15Z","closed_at":null,"body":"I wanted to export the DB to import to import it into a self hosted solution #49, but I get the following error message:\r\n```\r\nError exporting DB: /storage/emulated/0/Android/data/nodomain.freeyourgadget.gadgetbridge/files/ActivityDatabase:\r\nopen failed: EACCES (Permission Denied)\r\n```\r\nI also tried debugging data syncing before, but there was no debug log. Since no error was shown I didn't know why, but the above could very well be the reason. Maybe it would be a good idea to show a toast message just like when exporting the DB fails?\r\n\r\nSeems like adding\r\n```\r\n<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\" />\r\n```\r\nto the manifest could solve it. See http://stackoverflow.com/a/20631589"},"comment":{"url":"https://api.github.com/repos/Freeyourgadget/Gadgetbridge/issues/comments/151647382","html_url":"https://github.com/Freeyourgadget/Gadgetbridge/issues/153#issuecomment-151647382","issue_url":"https://api.github.com/repos/Freeyourgadget/Gadgetbridge/issues/153","id":151647382,"user":{"login":"cpfeiffer","id":1457896,"avatar_url":"https://avatars.githubusercontent.com/u/1457896?v=3","gravatar_id":"","url":"https://api.github.com/users/cpfeiffer","html_url":"https://github.com/cpfeiffer","followers_url":"https://api.github.com/users/cpfeiffer/followers","following_url":"https://api.github.com/users/cpfeiffer/following{/other_user}","gists_url":"https://api.github.com/users/cpfeiffer/gists{/gist_id}","starred_url":"https://api.github.com/users/cpfeiffer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cpfeiffer/subscriptions","organizations_url":"https://api.github.com/users/cpfeiffer/orgs","repos_url":"https://api.github.com/users/cpfeiffer/repos","events_url":"https://api.github.com/users/cpfeiffer/events{/privacy}","received_events_url":"https://api.github.com/users/cpfeiffer/received_events","type":"User","site_admin":false},"created_at":"2015-10-27T21:20:15Z","updated_at":"2015-10-27T21:20:15Z","body":"This is very weird. I'm trying to understand what happens here:\r\n- the exception occurs upon creation of the **FileOutputStream**, that is, the creation of the destination file, not the reading of the source file\r\n- further, the destination file is supposed to be /storage/emulated/0/Android/data/nodomain.freeyourgadget.gadgetbridge/files/ActivityDatabase\r\n- that directory is supposed to be the \"external files dir\", see https://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String)\r\n- in particular, every app (e.g. filemanager) having the READ_EXTERNAL_STORAGE permission should be able to read files in there\r\n- in my understanding, the directory should be owned by the app, not by root, and this is also how it is on my device\r\n\r\nIn that regard, the exception is actually correct, so we have to find out\r\n- why the directory is owned by root instead of gadgetbridge and\r\n- how to change or work around this\r\n\r\nOne workaround would be to add READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions, but I'd like to avoid this. If you can build Gadgetbridge yourself, you could try if this indeed fixes the problem. If you can't build it, we could try to get e.g. jitpack.io to build it for you."}}