Use of shared database in Windows 8 App - sqlite

I am developing a set of apps for Windows 8 which require local data storage and I'm experiencing a trouble in accessing the data from these apps. As far as I know, each app has its own location to store its data. Is it principally possible to access one file in Windows.Storage from different apps? I am using SQLite as a database server and it is necessary to have one common database to share data between the apps.

No, the applications are sandboxed so they cannot access each other's local data storage. If you're willing to have your application initialization process ask the user where to put/find the SQLite database, then the applications could share that same file at a location on the file system that the user has selected via the File Picker.
That means, of course, that the user has to remember where the file is whenever he first launches the "second" app, since he'll need to browse to the same location where he "first" app deposited it.
If you leverage AccessCache.StorageItemAccessList, though, you can save that file location in your app's local storage, so the next time the user runs either app he doesn't have to go through the File Picker to grant permission again.

Related

FinderSync invalidated on El Capitan

We have an application written in Mono that needs to communicate with an Finder Sync App extension.
All is working fine until we tried our app on El Capitan instead of on Yosemite.
We use a shared SQLite database to tell what paths are in which state and use NSDistributedNotificationCenter for communication between the two.
The shared SQLite database is outside of the sandboxed env so we have putted an excepention in our entitlements com.apple.security.temporary-exception.files.home-relative-path.read-write
If we remove this exception from the app extension, the extension works (but obviously we can't read our db)
Then we tought of putting the SQLite DB into memory, but shared memory databases isn't possible over multiple processes.
I can't find how I can create a NSFileHandle for a Sqlite Connection.
We could send over all the info to the application extension, but then that has to keep it in memory (preferably in a SQLite, cause we need to do some querying.)
Does anyone has some pointers of what we could do?
Try to look in The Application Group Container Directory it might do in your case. Basically it allows you to have shared folder between apps/extension.
App group container directories. A sandboxed app can specify an entitlement that gives it access to one or more app group container directories, each of which is shared among all apps with that entitlement.
After some research on similar problem I found it's much easier to have simple TCP server in main app that responds to extension with file status. This way you can easily broadcast file status change to all extension instances etc.

Sharing data files between users in a Universal Windows Platform application

I am about to embark on the development of a line of business application using the Universal Windows Platform (Windows 10). One of the requirements of the application is the synchronisation of data from a server to a local SQLite database; this is required because the application needs to be usable where there is no network connectivity.
It is likely that multiple (windows domain) users will be accessing the application on the same device, sometimes simply by "swapping users", other times by logging off the first user and logging on as a new user.
I realise that UWP applications are installed at a user level, however I would like to be able to share the SQLite database between these users instead of forcing each user to download their own copy of the data.
Is this possible? I am struggling to find any reference to this kind of sharing within the Microsoft documentation - but of course that documentation is new and far from complete!
I guess at the end of the day I am looking for access to a folder that is accessible by any user running that application on the same device, such as the "x:\Users\Public" folders that are available from the desktop, but without having to ask the user to provide access to that folder via any picker control - instead simply being able to "open" it.
Thanks.
In case anyone runs across this, this functionality is now available as described in this blog post:
We introduced a new storage location Windows 10, ApplicationData.SharedLocalFolder, that allows multiple users of one app to share local data. Obviously this feature is only interesting with devices that will be used by more than one person. For such scenarios, for example in educational uses, it may make sense to place any large downloads in Shared Local. The benefits will be two-fold: any user can access these files without the need to re-download them, also there will be storage space savings
Keep in mind that Shared Local is only available if the machine has the right group policy, otherwise when you call ApplicationData.Current.SharedLocalFolder you will get back a null result.
In order to enable Shared Local the machine administrator should enable the corresponding policy.
Alternatively, the administrator could create a REG_DWORD value called AllowSharedLocalAppData with a value of 1 under HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\AppModel\StateManager
Note that data store in ShareLocal will only be persisted as long as the app is installed on the device and won’t be backed up by the system.
In Solution Explorer , Right click on Package.appxmanifest then click on ViewCode , end of this file in both projects add below code :
<Extensions>
<Extension Category="windows.publisherCacheFolders">
<PublisherCacheFolders>
<Folder Name="FolderName" />
</PublisherCacheFolders>
</Extension>
</Extensions>
After that in code you can access this folder with below line of code :
StorageFolder sharedDownloadsFolder = ApplicationData.Current.GetPublisherCacheFolder("FolderName");
It`s so important that the folder you will share between two these Apps depend on same publisher info at Certificate File [ProjectName]_TemporaryKey.pfx , if this Certificate File and publisher Info of app is same in both Projects , then you can access the same SharedFolder in both application and use it for create or use dataBase file(like SQLite Database file) or other files that need to be share in both applications.

Large prepopulated SQLite database with Appcelerator Mobile

Just getting into mobile app development, and I have a couple of very basic questions relating to the use of a large prepopulated SQLite database. It's not a typical for-public-consumption app that captures a little bit of user data.
The app would be deployed to some employees of the company, not to the general public. We would like to attach their phones via USB cable to a PC and copy a 300MB SQLite db file onto their phones.
We would like to write a number of apps that know how/where to find that db file in the phone's file system, and issue selects against it. It would be read-only.
Is that scenario feasible with Appcelerator? Can the database file be located outside the folder structure of the app so that multiple apps could use it?
On both iOS and Android apps are sandboxed and can only access their own data. On Android you could use the external storage but then every app would be able to access it. Also, since on iOS the app won't be able to open the SQLite database from the read-only application resources, it will be copied to the application data directory, meaning the app will be 300+300MB in size. You better download the files once the app is installed.

Asp.net APP - Handle File storage on another computer

All,
I have an asp.net (asp.net 2.0) application that allows users to attach (upload) files to records (not much different from typical e-mail client) and then view those attached files later.
Typically, we will store these files on the webserver (i.e. on the same machine in app's directory or in another drive on the same computer). But, ... some of our client's would like to store these files on another computer (their designated file server that doesn't run our asp.net app) and here where the problem is: Since our application runs typically another Network Service account it will not have permissions to a directory on another machine.
The million dollar question is: For this type of setup, what are best options to make this setup work? I have listed some below that could elaborated:
1) Keep the files on the same machine as the app and tell client to use backup software to copy it to the file server at the end of the day (not really real-time)
2) Setup a share on the file server but ... how do I deal w/ security,- in other words, network service account is not privileged enough to copy files to shared folder. Do I?
2a) Run my app-pool w/ more powerful account?
2b) Is this possible? If yes, how to:- Use .net code to change current thread's SID to a more powerful account, copy file, and the switch back to network service.
Another issue with #2 is domain networks where policies are on the domain controller and require additional setup.
3) Other solutions????
I decided to use impersonation for directories that require user logon permissions. Here's a good reference material:
http://support2.microsoft.com/?id=306158
This solution works very well.

Open SQLite database on Google App Engine

Is there anyway to open and read a SQLite database file on GAE?
I am currently uploading dbs to blobstore as admin and serving them publicly to user clients. I just can't read them in the GAE admin interface.
You can use SQLITE on Google App Engine. The problem has nothing to do with the support of certain libraries. It has to do with read-only file system. There is, however, a writable /tmp directory. If your app on startup first copies the db.sqlite3 file to /tmp/db.sqlite3 and references this path as database path, it will work.
There are, however, drawbacks.
1. This is not a "real" directory i.e. it's stored im memory. If database is too large, one will get problems.
2. Each instance has its own copy of db.sqlite3 file. Does not scale well.
Here is a django example:
Using SQLITE for local Django development for Google App Engine?
Short answer, no it is not possible to use a SQLite database on a standard Google App Engine application as it is not currently supported. However, you can give a try at implementing your own configuration with the App Engine Flexible Environment that allows to take advantage of custom libraries through Infrastructure Customization.
In case you would want to experiment, here is a sample Django application designed to be run with its default SQLite database on the App Engine Flexible Environment. Still, make sure to read the database notice providing alternative data storage options and explaining that SQLite data does not persist upon instance restart.

Resources