What is best way to share iOS sqlite database between devices - xamarin

I created first simple iOS app using Xamarin & Sqlite database as backend. Everything works fine, now my next step is to figure out how to make data stored in sqlite available on more than 1 user's devices. Since sqlite database is stored locally on user's device, do i need to code and syncing or just rely on user to enable icloud and data just sync itself? My understanding on this is still entirely muddy. If I need to write code to do syncing, could you give some example code? You help is greatly appreciated. -Thanks
Below is code i used to create database:
var fileName = "TrackItem.db3";
var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
var libraryPath = Path.Combine(documentsPath, "..", "Library");

sqlite is only used for loclly, try using firebase

Related

Where is CoreData located?

I am writing an app which uses CoreData using NSPersistentContainer to save data.
While I am developing the app, I would like to:
examine the data directly
back up the data
see what happens when I change the bundle id
I assume the data is physically stored somewhere, but I’m not sure where to look.
By default NSPersistentContainer stores the database inside app container under directory Libray/Application Support
To locate the full path, in simulator, you can print the applicationSupportDirectory using urls(for:in:) function of the default FileManager:
print(FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask).first?.path ?? "nil")
If you are running your app on an actual device you can download the application container following this answer.
For sandboxed apps the location goes like this:
~/Library/Containers/…/Data/Library/Application Support/…

Appinventor: How to MANUALLY clear the persistent data when using companion?

I could not find the location in my phone for the data stored when using the App-inventor Companion. Can somebody help me in this?
The "AppInventor>assets" contains the pictures used in the app when using the companion but there is no database. I am using TinyDB.
to delete the assets, delete the directory /AppInventor on your device using a file manager app
to delete TinyDB, use the method TinyDB.ClearAll

App Group in Today's Extension Swift 3.0

I am developing a Today's Extension of an app. I am having some problems regarding App Groups that are used as shared containers between extension and containing app.
Where is the App Group data stored?
How to see what data is stored in the App Group?
Shared Containers is simply a UserDefault dictionary that is shared between Extensions in an App. To store data in the container Init your container using the suiteName UserDefault:
let SharedDefaults = UserDefaults.init(suiteName: "group.com.YOURGROUP")!
TheN to set a value, in this case a String:
SharedDefaults.set("something", forKey: "aKey")
And to retrieve the information (from either the Extension or App) use:
let myString = SharedDefaults.string(forKey: "aKey")
This explains how to to print the contents of the UserDefaults: Easy way to see saved NSUserDefaults?

SQlite.Net.SQliteCommand ExecuteQuery requires class

I am working on SQlite with Windows Universal App. I have a scenario where the column names are unknown and want to fetch the data from Sqlite table. The method ExecuteQuery in SQlite.Net.SQlite.SQlCommand expects a class name to be passed. I tried with dictionary but no luck it comes as a empty. Anything related this would be helpful. I cant find much document online.
SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), sqlpath);
SQLiteCommand cmd = conn.CreateCommand(query);
List<Dictionary<string, string>> datalist =cmd.ExecuteQuery<Dictionary<string, string>>();
What you need is actually map it to a list of dynamic objects with SQLite in UWP app, I'm sorry to tell you that SQLite for UWP doesn't support this function.
And Dapper.Net is now not available for UWP apps.
You can try to use web API/service to solve your problem, for example you can submit your data to the web API, web API uses dapper to get data from your database and pass it back to your app.

How to use the File API to store text data in the samsung TV?

How to use the File API to store text data in the samsung TV ?
And the data will "live" until the application uninstalled.
I implemented video api of samsung tv. When start my api, asking for user login account. But, I want to store user's login details. User don't need to enter every time login credentials. If once user logged in, and next time username and password should pre populated with details. I think file api is useful for me. But don't understand how to use it. Where to store file which is going to use or what should be extension? And how to access that file fileSystemObj.openCommonFile(curWidget.id + '/testFile.data', 'r');
what is this "curWidget.id" I mean how to use it for my app?
Please, guide me. Or if possible provide me an example.
curWidget.id is widget id of the app in the widgetlist.xml is written widget id.
I hope it is helpful for you
curWidget.id is identificator of installed widget, it is provided by smart hub. When you publish your app, it is generated by seller site.
Basic guideline about files: your app should create directory for its files. Recommened path is value of curWidget.id property.
Example available in Samsung documentation: http://samsungdforum.com/Guide/?FolderName=tec00111&FileName=index.html
var fileSystemObj = new FileSystem();
if (fileSystemObj.isValidCommonPath(curWidget.id) == 0){
fileSystemObj.createCommonDir(curWidget.id);
}
var jsFileObj = fileSystemObj.openCommonFile(curWidget.id + "/data.dat","w");
/* Some code */
fileSystemObj.closeCommonFile(jsFileObj);
Your files will stay and after app uninstallation. You will have to remove them yourself. This is also covered in guide.

Resources