-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Save/Load settings [Feature request] #588
Comments
I assume when you say 'alarms settings', that you want to export all alarms/notifications (and their individual settings). There is already similar save/load functionality for actions, places, and themes. |
Yes, export & import all alarms/notifications with their complete settings. Really great to hear it is coming, than you very much! |
export alarm list to json array (#588)
import alarm list from json array (#588)
A few caveats.. The items that are imported will probably fail to play the configured sound (and fallback to the default). These are URIs pointing somewhere on the filesystem, sometimes with an associated permission granted when the file is selected (which is also lost). The sound will have to be (re)configured after importing. The import process doesn't recognize or handle duplicate items. Importing the same file more than once results in a list full of duplicates. The intended workflow is to clear the alarm list first, and then import. I think it makes sense to allow exporting individual alarms, but for now the process is for all alarms (like a backup). |
Very true. Could it be enough, if a dialog (having the checkbox: "Do not show this again") would be shown when the user enter into the import as well as the export function, telling something along these lines: "Defined tones that are not available in the destination device will not play. Either transfer the associated audio files using a file manager, or re-define the events tones".
In my opinion, creating one notification or one alarm is not a big job, it actually may be faster to do than to export one to a backup file plus transferring the file to another device plus importing the file to the Suntimes. I believe that that the backup like process (that includes all notifications and alarms) is well enough. Perhaps there could be a checkbox for the user to choose if the existing alarms are cleared away or not. |
I now have the version 0.14.4 installed on Android 7 device and it is working nicely. The worldmap widget is so nice now that I open the device just for the sake to look at it again. Some findings: Import is additive, that is very OK since it allows me to choose to first clear some or all of the existing notifications, and then do the import. Interestingly, when doing export the device shows many apps that I can use for saving/sharing, e.g. the "Total Commander for Android" and "Zarchiver Pro" but not default "Files" app. But when doing import the device shows only one app, the "Zarchiver Pro" (again the default "Files" app is not included). Luckily the single choice was available, I had just defined (once again) all the 21 notifications. |
In Xiaomi Readme Note 9T (Android 11) the export of version 0.14.4 function does write the *.json file, but the import function is unable to reach to that location. The import function opens the default file manager (no other options), in it I can browse everywhere on the scdard but a *.json saved there appears as greyed out (because Suntimes does not require permission to the sdcard nor to any folder on in). When browsing the internal storage, I can open the Android/ folder but there visible are only two folders (dtgsync/ and media/), when a *.json is stored into them, they can be seen but are greyed out. So, the path Android/data/ is not visible. When browsing with the 'Total Commander for Android' app, under the Android/ folder are:
Under the " ->Installed Apps" item are working folders for all installed apps and also the folder "com.forrestguice.suntimeswidget/cache/" folder, and the exported *.json files are there, I can also add files there, but again, this folder can not be reached from the import function of Suntimes. In the 'TC app, selecting "Open with" on a *.json file, will open a list of apps that are compatible with *.json files, but Suntimes is not on that list. |
Good feedback. I think I understand whats happening. First, the export saves the file into the app's cache. It then offers to share/send that file. Finally it displays a message (with a path to the file). Suppose you don't share/send the file (no apps can open it), then its trapped in the cache. The path displayed afterward is meant as a last resort, but as you've discovered, other apps are unable to access it (a utility like On my devices there are more export targets (but I installed those apps). For example, a popular file manager (Amaze) offers to 'save to file'. I think the limited options are because of the mimetype- the file specifies an octet-stream (vs plaintext). If it was plaintext you'd see options to copy/paste, or open it in some text editor. I also see options to attach to email, or send via bluetooth. It is a problem that the default Files app isn't in the list.. :\ I think the app can do better - for newer devices we can use the storage-access-framework to get a temporary URI permission, then write directly to sdcard (also avoids needing additional permissions). In the next patch
Wow!! No wonder this feature is needed! |
hrm, those files on sdcard should be accessible. You are able to select alarm sounds off the sdcard? |
..nope - its not declaring the permission at all actually. This should be fixed in the next patch. |
On the Android 11 device (Xiaomi) when I browse from "Audio File" the default filemanager opens, I'm able to browse the sdcard, and select (long tap) an *.mp3, then the filemanager shows "1 selected" and a textlink "select" which I tap, that brings me back to the Suntimes "Alarm" definition, but the initial audio file does not change. The initial audio file is the *.mp3 that I have set as default audio in the Sound Settings of Android OS, (that file resides on the internal storage). But, the sdcard access is not needed all by the Suntimes app, I should have not taken it into discussion at all. The main issue is that in the Andoid 11 device the "Import" function of Suntimes 0.14.4 is not able to browse all the way down to: /// "internal shared storage" / "Andoid" / "Data" / "->Installed Apps" / "com.forrestguice.suntimeswidget" / "cache" folder, so there is no possibility to import the alarm/notification list on Android 11. Using the TCfA I can see that the exported *.json files are there, and with the built in editor of TCfA I can inspect their contents, and they seem to be OK, so the "export" function does work OK. I have now installed the version 0.14.4 on devices that run Android OS 7.0 and 8.1 and 9 and 11. On all other but the 11 both the "export" and "import" functions works perfectly, on 11 the "import" function is not able to to import. |
show a warning that imported items may not retain all settings (#588)
I will need to investigate the ringtone selection issue separately - a separate issue is probably required to track it. It seems there is more than one confounding issue at work.. sdcard vs internal storage, and different behaviors depending on OS version. I've tracked the issue with being unable to select previously exported files to the chosen file extension / mime type. The json mimetypes are just not treated the same by all devices. If I choose The solution isn't great - the dialog now looks for |
Yes, it is separate issue, however likely related similarly related to the new permissions requirements that were introduced in Android OS v.11.
In Andoid OS v.11, in the context of internal storage, this is not related to file extensions/type, because if is not possible to browse down to the: /// "internal shared storage" / "Andoid" / "Data" / "->Installed Apps" / "com.forrestguice.suntimeswidget" / "cache" -folder, so what ever there is can not be selected. In Andoid OS v.11, in the context of SDcrad storage, I'm almost sure that apps must request and get permission to access the SDcard, either as whole ("Files and media" or so called "all file access" permisson), or permission to access just a single folder. Google destroyed/crippled many apps with this new rule in OS 11. |
This is resolved by allowing the export to save directly to file; in
The sdcard permission is considered sensitive so newer OS versions penalize its use (and users distrust it). Instead something called "URI permissions" is offered as an alternative. To use those we must use the Storage Access Framework APIs to show a selection dialog, and the act of choosing the file grants permission for that single file. The URI permission is something that is supposed to persist between reboots (tracked by the OS), until eventually the app releases it.
It do think its likely Android 11 broke something - every version seems to deprecate something important, or include change for the sake of change. :\ I've read about the storage changes though and don't think they apply - according to the docs the app must target Android 11 to be affected (Suntimes currently targets Android 7). If I understand those changes correctly, the sdcard permission is now "scoped" and access is now restricted to a handful of locations (with an additional permission needed to bypass that). We don't require unrestricted access though, so I don't think either of those permissions are needed - its actually preferable having to show the selection dialog, vs having the ability to write anywhere/anytime we want. I tried (and failed) to reproduce the ringtone issue with an emulator running Android 12, so there seems to be something in addition that I'm missing. There is also a lot that is untested.. I wasn't aware, for example, that its possible to set the default system ringtone to some music file (but that also worked when I tried it). It doesn't help that |
I'm reading more about Android 11 changes, and the docs make a distinction between "media" and "non-media" files, with access to the "media location" requiring yet another permission. Maybe this is what is causing the problem - when I tested this, it was by uploading a file to the Download directory (on sdcard), which afaik isn't part of the "media store". That is also how I tested the default ringtone. |
Great! Export and Import of Suntimes v.0.14.5 now works perfectly on Android 11, saves properly to internal and to SD card. What a relief! I've not yet had the opportunity to update other devices, but I'm sure it'll be same with them also, as only the Android 11 was giving troubles. BTW1: I notice that there is a nice new 2x1 Sunrise & Sunset (1) -layout, that in the Reconfigure panel shows the sunrise on top left, sunset at top right, and on the 2nd row the local time of the solar noon at the horizontal center. But what ever I do, the widget on homescreen only shows sunrise and sunset. I have scaled the widget while having different Appearance setting (scale and fill -combinations). BTW2: When I set up the 1x1 flippable widget that shows the Solar Noon, with no title (or just plain text as the title) the widget gets to the homescreen OK. Then when I reconfigure, and enter %dt alone as the title, and tap the OKwedge to go the homescreen, the widget is gone. After that, selecting 3dot/settings/widgets from either of the apps will simply drop me to the Android homescreen. I have not found any way around this but by doing clean install, so I hesitate to reproduce this on configured devices because there is some hard labor ahead in redoing the settings and widgets. When this happened I did reproduce it once, just after a clean install. This is on Xiaomi (Android 11). Very minor issue surely, and there is no real need to have any substitutions on the title of in that widget. I have the same %dt on Sun Position widgets 3x1 and 3x2, and on Moon widget, all is OK with them. BTW3: After clean install, when Suntimes presents the Location permission request, it give the three choices: "only when using this app", "this time", and "deny". Above them there is a link to the permissions panel in Android settings/apps/setting, and only there one can select "all the time". A million thanks again! |
Export and Import also OK in Andoid 7.
Eh, I found it finally "Show solar noon" -checkbox. I was clever enough to be able to see it during a many hours long setting/experimenting session. I'm only hoping that there could be a more easier/faster way to get into the settings of each widget, directly. Likely Google does not allow such user experience. |
Hi, I'm hoping for 'Save / Load settings' functionality, that would contain at least the Suntimes Alarms settings, as a file that can be shared between devices.
The text was updated successfully, but these errors were encountered: