Share local SQLite database in 2 different xamarin forms apps - c#

I am working on two different Xamarin forms apps and there is a need where I want to share the SQLite database of first app with second app.
I want to achieve Single Sign On approach for different xamarin forms apps,
Where user will only log in in any of the app and can stay logged in in both the two apps.
I found below link which stats in android we can share the database:-
Share LocalDB in two different android app
now I only need is similar thing in my xamarin forms app.
Any help will be grateful.
Thanks :)
Enjoy!

In the case of iOS, it's sandboxed so sharing data between applications are so difficult. But there are still some ways to share data between applications.
In your case, I recommend you using App Groups. An App Group allows different applications (or an application and its extensions) to access a shared file storage location, please refer to Working with App Groups for more details.
After Adding an App to an App Group we can use the methods below to share data between applications:
NSUserDefaults:
var userDefaults = new NSUserDefaults("<your group ID>", NSUserDefaultsType.SuiteName);
userDefaults.SetString("user123", "userId");
userDefaults.Synchronize();
NSFileManager:
NSUrl appGroupDirectoryPath = NSFileManager.DefaultManager.GetContainerUrl("<your group Id>");
NSUrl dataBaseUrl = appGroupDirectoryPath.Append("dbName.db", false);
//You can try to copy your dataBase file to this url.

Yes it is possible to share the data between two iPhone apps ...
If anybody need more information on this please go through the below link which will explain how to achieve...
Using your App Group
App Groups are the scheme iOS uses to allow different apps to share data. If the apps have the right entitlements and proper provisioning, they can access a shared directory outside of their normal iOS sandbox. Sandboxing still applies except for a single exception.
This is probably almost automatic, but when you get into iOS app provisioning you can't assume anything. What's supposed to happen is that you just turn on the "app groups" entitlement in Xcode for the app and for any extensions..
Link for:-
Sharing the app extension
#Land Lu - MSFT Thanks for the suggestion your answer led me to get it done.

Related

List launcher apps from Office365

We are looking to create our own "My apps" From Office365 to create a launcher.
We currently use microsoft.graph for other functionalities (like authorization) but I don't see a way to get my tenants available apps.
Using getSubscribedSkus and the users's assignedPlans / assignedLicenses we can figure it out, but that shows nothing about pinned tiles, images, urls etc.
Is there another way to get this done?
Thanks!
There is an Applications API in preview under /beta: https://graph.microsoft.com/beta/applications. The API is documented here: https://graph.microsoft.io/en-us/docs/api-reference/beta/resources/application
We currently use microsoft.graph for other functionalities (like authorization) but I don't see a way to get my tenants available apps.
As far as I know, there is no API to achieve this so far. You may consider submitting a User Voice on https://officespdev.uservoice.com.

Can I create a mutual login system for multiple windows store apps?

I have multiple windows store apps of a company and all of them have signing in option. What I am trying to do is create a mutual login system for all of my apps. In simple words, If user log into one app then he automatically signed in other apps.
I am using sqlite locally to maintain user's session data. So, I tried to access the one App sqlite file from other app by giving a static path to its installed location. But it won't open the sqlite file.
Can I put this sqlite file in any folder where other apps can access it too?
Is there any common folder/storage space in windows store app where other apps will be able to access this sqlite file?
Any help would be really appreciated, Thanks in Advance!
Although it doesn't help right now, Windows 10 does have a solution for apps from the same publisher sharing data. You can use ApplicationData.GetPublisherCacheFolder(folderName) to get access to one or more folders that you share amongst your apps.
As far as I know there is no common storage between apps. The best you can do is to store the sqlite file somewhere locally (let the user choose) and then hold permission to access that file in the MostRecentlyUsedList
This will allow your app to access it at any time. However, the user will have to manually open the file at least once with each app that needs to use the login.
The only way I can think of to do what you're trying to do without user interaction would be to write your own server backend and use the IP address / user agent string and other variables to uniquely identify a device. When the device logs in then all other requests from that device would be considered "logged in" until the user logs out from one of them.
This would be very insecure and I would not recommend it. Anyone could impersonate the user if they knew enough about the device they were using, and were behind the same router.

Access Android in-app purchase info with asp.net c#

I currently have an app on the Android Google Play market which has a few in app purchases available.
I am looking to add another one which would be a subscription to give them extra functionality not only in the Android app, but also on my website too.
The availability of the feature on the website would be tied into the Android app and if the stop subscribing in the app then I would want to stop access on the website too.
Is there a way to check if they have purchased an in app upgrade using asp.net (preferably with c#, however open to other methods) and if so could you point me in the right direction as to what I need to do please?
My attempts at Googling this has returned no results so I am not sure if this is possible or if my Googling is just rubbish!
Thanks.

how to handle different accounts with Win8 app c#

Hi guy's I just had a wonder moment I want to create an app for c# where users manage information I have read how to create authentication with windows azure ( which seems awesome ) but I was wondering how do apps link a user to their info i.e. when you log into treehouse you only get your Info , how do apps do this after authenticating the user just wondering any guidance would be helpful in c#
In Win8 apps, I believe you should be accessing data through IsolatedStorage which gives a unique store per user per assembly...
http://msdn.microsoft.com/en-us/library/System.IO.IsolatedStorage(v=vs.110).aspx

How to save user data in C# Winstore Metro app permanently?

I have some user data in my Winstore C# app. I just learnt that local store and app data are being erased after new version of the app is installed (or user reinstalled the app).
How to permanently store the data? Can it be done transparently for the user?
What about enterprise class of apps - how do you guys access more robust data like databases?
Removing all local data when an app is uninstalled is the expected pattern for Windows Store apps.
If you want to store data permanently, my recommendation is that you consider building a back-end data store and services to access them. Then you control the server-side data, and can associate the data with the users when they install your app (note that if you plan to store data and not delete it when the user uninstalls the app, you should probably call that out in your app's privacy policy).
There are several good options in terms of building back-end services, and I explore several of them in a blog series I'm currently working on:
http://bitly.com/bundles/devhammer/2
The series covers building a back-end game leaderboard service which stores data in a SQL Database on Windows Azure (though the concepts are applicable to services you host yourself as well), using one of 3 stacks:
WCF Data Services
ASP.NET Web API
Windows Azure Mobile Services
Any of those three stacks will allow you to create a robust back-end for your apps, and can be leveraged across platforms.
With respect to transparency, you can definitely make the above services functionally transparent to the user, but as noted above, it's a good idea to also be transparent about the fact that you plan to continue to store data after the app is uninstalled, and perhaps even give the user options for deleting their data. Pete Brown recently posted a good overview of traits of a good Windows Store app privacy policy, and addresses this a bit in the post:
http://10rem.net/blog/2013/01/21/traits-of-a-good-windows-store-app-privacy-policy
For more info on Windows Store app development, register for Generation App.
You can use something like Skydrive or Dropbox to store the files.
EDIT*
There is no database access support in WinRT. While you can use something like SQLite to store data locally - it would be used mostly for caching and it would be expected that you persist the data somewhere in the cloud, so you should still upload the data you want stored somewhere outside of your machine.
If you want to store files on your machine that don't get deleted with your app - you can save them somewhere in the documents/pictures/music/videos libraries, depending on where they fit best.

Categories