Closed pliablepixels closed 6 years ago
Based on this, quota seems to be a potential issue. The backed up data is tiny, but I'm checking for that now.
Closing. My backup is still not working. After switching backup accounts and rebooting, doing a manual backup does work (I see a backup file on google drive). However, if I delete the app and reinstall it (via adb install), the cloud settings are not restored because the load()
function only returns a timestamp:
field not the rest, which is odd. I'll be debugging further.
OK. Also see the example project for comparison.
Everything seems to be working with my project today 🤷♂️
So far my testing has involved manually invoking the backup of my app data after I invoke the save()
function and it works.
I only wish there was a way to make the backup instant! I've tested by manually invoking backup now
from adb shell
so far - I suppose that validates backup itself is working and this plugin is correctly saving the data locally for remote backup. Still waiting for auto backup to kick in.
Thanks for the plugin!
Hi @dpa99c, I am also using this plugin and facing the same issue as @pliablepixels. In iOS it is working properly as expected but for Android the auto backup is not happening. I've also tried through command line and the backup happens but I want to try the backup in real scenario.
Currently I've Android 10, so as per docs auto backup should happen instead of key/value backup but it is not happening. I also build the example project that you have mentioned in the above comment and tried it out but auto backup is not happening for that also. The Backup settings is enabled for my phone and is set to Wi-Fi.
I have few questions:-
Thanks in advance!
I thought I would contribute here. I have a few apps that utilize cloud settings backup. One of them open source if it helps to poke around: https://github.com/pslyman/OpenTrackFit
Android backups happen once every 24 hours, or when you manually run them (Settings > System > Backup > Back up now). If you uninstall the app, it will remove the backup too, IIRC (don't quote me on that one, it may have changed). The app cannot be installed via ADB to restore the cloud backup. It must be installed through the Play Store, or by automatic restore on a new device.
@SnehalJ1509
When I tested this plugin, I had another phone (emulator works too) that I would use. I'd make the backup on phone 1 (including saved JSON through the plugin) then set up phone 2 (or emulator) as a new device, restoring from my most recent backup along the way. It may work to just install the app from the PlayStore instead of restoring from backup, but I had to be sure when testing. I don't think ADB will work.
It's finicky and ridiculous, but I don't think it's the plugin's fault. It's just the way Google handles things.
Thank you @pslyman for the answers.
As mentioned above, first I tried with adb commands and the backup works. I checked it in Google Drive -> Backups -> {phone_name} backup -> App data -> {my_app_bundle_id}. It shows proper date/time. After that I've also tried with allowBackup and fullBackupOnly set to true, updated the JSON, saved it from app and then manually took the backup through settings. Then when I checked in Google Drive, I can only see the backup I took through adb earlier. I don't see the updated date/time for my app.
If I check in the app, the load() still returns the updated JSON saved through app. But if I uninstall the app and install it again in the same phone, the exist() gives me true but when I run load(), it gives me JSON saved through adb and not the updated one saved through manual backup. So it seems confusing if I am missing some configuration or I am doing it all wrong.
Thanks for your repo link. I'll surely check it out how its implemented there.
@SnehalJ1509 Thanks for clarifying, I had misunderstood. I may not have a solution, but I find it curious that ADB vs Google Drive cloud settings don't seem to match. I do know that Google is very particular about how they do things, so there may be an inconsistency between ADB and a key-signed version through the Play Store. If you find what you're doing matches up with my repo, consider making a signed closed beta release that just you can access, and do a bit of testing that way. It's cumbersome, but maybe it'll unveil something you hadn't noticed before.
I'm under the impression that your configuration is correct. Hard to say beyond that though, assuming your API key is functional.
@pslyman Currently I am just doing POC so not doing it through a key-signed version. Just testing with dev build, creating an apk and installing it in my phone. I am not sure if this is the reason for not working but ideally that should not be the case.
I checked you repo and everything seems same as what I have done except the save part where 1st you are saving blank json and then the json data. Why is that? If that is to replace the existing the data then may be you could have passed true as another parameter to it.
I've generated an API key from Google console and probably that should also not be a problem.
@SnehalJ1509 You're correct that I don't need to be saving blank json, good catch. It clears the cloudSave before loading new data, but it isn't necessary with that second parameter. I'll have to update that.
A couple of observations:
Although you can do a cloudSave (saving JSON to the app data), and then test that it exists, I've never been successful in getting Google to back it up unless I have a key-signed version I've downloaded privately through the Google Play Store. Maybe that doesn't matter? I've been under the impression that it does.
Uninstalling the app has always deleted my cloudSave for some reason. If I install the app on another phone or do a Google restore on another phone, then it works. Unfortunately it's always been very finicky and difficult to test for me without a secondary (or emulated) device. The cloudSave system may be more flexible than that, but it's been the biggest headache for me to test.
If your code is the same as mine, it may be worth doing a key-signing, dropping the APK onto an internal testing channel of Google Play Store, then installing it that way. Manually back up in Google's settings, then do a restore through your Google account on an emulator or second device. That was the only way (months ago) that I was able to get it to work. Unless Google has changed things since July, I'm not sure what to suggest.
I totally get just doing POC though, may not be worth the effort. Best of luck. I'm happy to help out how I can, but I think I'm out of idea.
@pslyman I tried with key-signing and published the APK in Google Beta testing and installed it from there. I manually took backup but still the backup is not appearing in Google Drive. And after uninstalling the app and reinstalling it in same device, I still always get data in cloud as false.
So now it feels like a dead end. I am not sure what I am doing wrong.
Hi, based on #7 I retried my backup attempts and I do believe the problem is not a case of delayed backup. I am doing something wrong that is resulting in backup failure (I incorrectly wrote it worked earlier)
Android OS version: 7.0
Here are my backup settings:
Here is how I am trying to do a manual backup:
My apk Sdk versions:
The error I see on logcat:
Gist:
Full Log: