Unity PlayerPrefs not saving across re-installs on Android - c#

I have a 'Money' PlayerPref, I'll give myself money, make it save, upon reinstalling the android APK, it deletes ALL the playerpref's, including owned objects ETC. please help.

Any data that is saved on an android device is associated to the application. When the application gets uninstalled, so does its data.
When an application is updated however, the data precists on the device and only the application gets updated.
To allow data to persist across devices or installs you need to use a remote server to store the data, such as Google's Saved Games Service.

You do not have to necessarily save your data in any of the clouds. ***
Save the data on the external sd card in custom folder
*** and access that data from the game everytime. Make sure to include the if(!data.null) exception handeling for security purpose.

Related

firebase database does not update local data

I am having a wired problem. My Database is not updating its local data.
I use Unity3D with C# and deploying for Android.
I set
FirebaseDatabase.DefaultInstance.SetPersistenceEnabled(true);
and everything works just fine in the editor, because caching is not available anyways in editor.
Going on Android, when I install the App it downloads all the data correctly. Once I set ne data, it gets also saved in the cloud online but once I want to access the data again, it still has the old data that was created on app init. Even if I restart the App it does not update the local data. Therefor the local data and the cloud data get async.
I am a little confused, because the connection is available, I can write data to cloud I can access them if there is no local data available but it will not update.
If I go to Android App Info and delete all App-Data it downloads the entire firebase again but keeps it not sync.
Can anyone help me on that problem?
Thanks a lot and best regards,
Luke

Storing data in Windows App

I have made a Windows App which is a spelling game, the user has a score, for example if a user gains a score of 180 when they close the app and reopen the app the score is not there anymore. Can people please give me methods of resolving this so it stores everything about the user (score and name) in which they can later access it if they close the app.
The Windows Store API provides a way to write your own local data to the file system, as described here:
Accessing application data
You read and write to it just as if it were a normal file on your hard drive, you just have to use their API in order to get the file handle.
You could of course also use a web service and store the data in a database, but given your experience/app complexity, thats probably a path to take with a different applciation.

how to use persistent database in android application

I am developing an android app in Xamarin(C#) using SQLite database. But the issue is every time I install the application on emulator or mobile phone, the old database is deleted.
Is there any way I can make database permanent? I want it to be present on the device even the application is uninstalled assuming that the user will be re-installing the app again.
How do I ask user if he/she wants delete everything while uninstalling the app and then erase all the data or maintain at least the database if user does not want to delete everything?
It's not possible to keep a database if you uninstall the app.
Is there any way I can make database permanent?
Short of a custom ROM of some sort, nope.
How do I ask user if he/she wants delete everything while uninstalling the app and then erase all the data or maintain at least the database if user does not want to delete everything?
You won't be able to prompt the user as they are deleting applications to perform some other action. If this was an option that was available, unscrupulous developers could use such a hook to reinstall their application in a different location and this is bad.
You could, however, include some sort of preference that allows the user to backup their data and copy the database to a location out of your apps private directory. Of course, you would have to provide your own way of encrypting the data if it should be private, and there is no guarantee that the file will not be deleted by the user, another app, etc.
If your information is not sensitive in nature, perhaps writing the database to a public directory (anything other than your application filesDir or externalFilesDir from the start is the way to go. Files in public directories are not deleted when the application is uninstalled.
You may have a greater problem though. If the user is switching devices, a local copy of the database isn't going to help. You'll need someway to download the information and restore state. At this point, most people resort to sending the information to some sort of web service. Android's Backup Manager may be helpful in your case.
When you launch the emulator be sure "Wipe User Data" is not checked. This will allow the data to persist while you are testing. I don't know if it is possible to keep data after an uninstall because it is by default stored in a directory off the application root called data/data

How to store RoamingSettings offline?

i was reading about windows 8 lifecycles and how it saves the user's date & stats of its apps at the suspension and termination modes , but there were a note that got me thinking it was as following :
RoamingSettings. The roaming settings app data container makes it easy to store data in a way that is accessible to the user across multiple machines. Basically, the data is uploaded to the cloud in the background for you. You can also use the local settings app data container (LocalSettings), but you should only use it when you want to store machine-specific info.
what i don't understand here do i have to store my data on the cloud to use the RoamingStettings ? what if i don't have a persisting connection , what if i want my app to store all the states data offline ?
that's my question
thanx in advance
No you just use Roaming folder and settings without worrying about how it is done

Implementing a desktop .NET application that can work offline.

I need to create a desktop WPF application in .NET.
The application communicates with a web server, and can work in offline mode when the web server isn't available.
For example the application needs to calculate how much time the user works on a project. The application connects to the server and gets a list of projects, the user selects one project, and presses a button to start timer. The user can later stop the timer. The project start and stop times need to be sent to the server.
How to implement this functionality when the application is in offline mode?
Is there are some existing solution or some libraries to simplify this task?
Thanks in advance.
You'll need to do a couple of things differently in order to work offline.
First, you'll need to cache a list of projects. This way, the user doesn't have to go online to get the project list - you can pull it from your local cache when the user is offline.
Secondly, you'll need to save your timing results locally. Once you go online again, you can update the server will all of the historic timing data.
This just requires saving the information locally. You can choose to save it anywhere you wish, and even a simple XML file would suffice for the information you're saving, since it's simple - just a project + a timespan.
It sounds like this is a timing application for business tracking purposes, in which case you'll want to prevent the user from easily changing the data. Personally, I would probably save this in Isolated Storage, and potentially encrypt it.
You can use Sql Server Compact for you local storage and then you microsoft sync framework to sync your local database to the server database. I recommend doing some research on the Microsoft Sync Framework.
Hello all I implemented this application I've created my own off-line framework
based on this article and Microsoft Disconnected Service Agent
DSA
I've adapted this framework for my needs.
Thank you for all.
you can use a typed or untyped dataset for offline-storage.
when online (connected to internet) you can download the data into a dataset and upload it back to the database server. the dataset can be loaded from and saved to a local file.

Categories

Resources