I have an Android application using the Data Backup service. After installing it using Eclipse on a device I can save some data and they become backed up well so far. I can also wipe the data and have them restored. This works as well. If I now take another device and install this application (again with Eclipse) like I'm going to switch the device, the restore process gets executed but don't deliver any data. (like there aren't any)
I'm asking me why. The package is the same, the google account too. Have I missed something in how data are mapped to apps?
Related
I'm working on an Anti-Theft app. Supposing that my phone is stolen, the first thing a thief will do is factory reset it, what means all apps and data will be lost.
I can convert my app to a System App and it will probably "survive" a hard reset but its data will be lost. Is there a way to keep the app and its data after a reset?
If it's not possible to keep its data, I thought I could store its settings in a file, but it would be erased too. Is there also a way to keep a file after a reset?
Edit: I don't want its data. I want its data not be erased after a factory reset cause erasing its data means erasing all user settings. Since I'm developing an anti-theft app, if a thief resets it, the app should keep its data (user data like a email and phone number) to contact the owner even after a reset made by the thief...
Why do you want a copy of the data after it's stolen (????). May be you have a use case. Anyways, if you are basing your app on API level 23 and above, you can have a look at this - https://developer.android.com/guide/topics/data/autobackup.html
This kind of automatically does what you wanted to achieve.The backed up data is on Google drive of the user account but it's of no use unless restored. Funny thing is, the autobackup feature would actually restore this data after the app is installed again (and the same user has logged in).
This will not really help if you don't have the phone (i mean if it's stolen :)). But if you want to persist app data across app uninstalls and factory reset, autobackup would do the trick for you (available only on API level 23 and above)
It is possible to recover data once a mobile is factory reset or so was uncovered by some Cambridge University researchers in the paper titled Security Analysis of Android Factory Resets published in 2015. I haven't had much time to go through it, but it looks promising.
It seems they did manage to get master tokens even after factory reset by utilizing some flaw in android system where the composition of flash drives make them dangerously hard to erase. Seems something you can experiment with depending on the usage. Do go through it once.
In my application (iOS and Android), I have to create sync process in which changes in one device (suppose iOS) reflect the same on other one (suppose Android) I.e. something like real time method callback on other device with data change. Also is it ok if I try to create XMPP server for this?. I know it is use for real time messaging thing but just to reflect changes on other device can we use this? Plus if you are going to suggest third party API then preferably free one.
I have an app for Android, that saves data to sqlite database in a common way. As the user works with the application, the data is changed etc. So far no problem...
But when the user use some back-up software (like Titanium Backup or others), make a backup of the application, he can restore the data to old state. I need the way to protect application from this or to detect the restoration and handle it.
The simple workflow:
Install APP
Work with APP
Reach the STATE1 of APP's database
Back-up the APP (with any backup/restore application, the device can be rooted)
Work with APP
Reach the STATE2 of APP's database
Restores the APP (or just data) to STATE1 - this is the point I need to deny or detect on the next execution of the APP.
So far I played with the Access-time detection and comparsion, but it seems to be really un-reliable through different devices and ROMs.
Thank you.
To do this you need to save some state off the device, or at least outside of the data directory. The easiest way is probably to save the fingerprint of the DB file in some 'hidden' directory on external storage (SD card). Or if your app has Web login, etc. store the fingerprint for each user.
In any case, the user has full control over the device so you can't prevent this 100%. Your app needs to gracefully handle any changes in the DB or simply fail if it detects a fatal inconsistency.
I've implemented backup/restore of SharedPreferences using BackupManager as per the Android docs, but I'm having trouble restoring preferences to a second device. I believe the implementation is fine, since I can restore settings to a single device, i.e. if I run the app, make changes, uninstall and reinstall I get the modified preferences that I expect. However, if I subsequently install the app on a second device, I don't see the changes, even if I use the bmgr tool to force a backup on the first device and force a restore on the second device. Both devices have the same Google accounts, and both devices successfully restore their own backed up preferences on reinstall. I just can't get them to restore changes made from a different device.
If I install the app on a new device, I would expect it to restore the latest preferences, never mind from which device the backup was made. I've also set the android:restoreAnyVersion="true" flag, but that made no difference. What am I missing? If the devices use different transport services, could that cause the problem I'm seeing?
What is the best way to let my users perform an application update?
Is there any way to force device reboot after the update? I'm asking this because my application registers some behavior on boot.
Please note, the application would not be published in the Market.
Update:
My app will be preinstalled on a set of ~100 handsets.
Should I periodically call a webservice that will inform the device about upgrade available, and then, redirect to an .apk file within a webkit view?
What is the best way to let my users
perform an application update?
Via the same way they got the app on their device in the first place, presumably. If they are getting the app via firmware, they get app updates via firmware updates. If they are downloading your app via your Web site, they get app updates via your Web site.
Is there any way to force device
reboot after the update?
No, thank goodness.
I'm asking this because my application
registers some behavior on boot.
There is some way you can be notified that your package was updated, though I do not have the technique handy right now. Just run your on-boot logic there for the first round, then subsequent reboots (if any) will be handled by the on-boot logic itself.