Simple SD card compatible database / NoSql solution for Windows Phone 8 - c#

Does anyone know of a good database or NoSql engine for Windows Phone 8 that can be used by my app?
I need to be able to open a read-only database file from the SD card. It needs to be able to cope with storing blobs (png images) as I want to use it to provide map tiles for offline use. 100,000's of image tiles will need to be stored in the database.
I've experimented with SQLite for Windows Phone via C# wrappers, but I don't seem to be able to get it to work with a database file located on the SD card.
There are limitations with Windows Phone apps accessing files located on an SD card, but it is possible:
http://msdn.microsoft.com/library/windowsphone/develop/jj720573%28v=vs.105%29.aspx
Feedback from a Microsoft employee regarding my difficulties with SQLite:
Windows Phone apps can read specific file types from the SD card using
the Microsoft.Phone.Storage APIs.
I expect that the SQLite implementation for the phone tries to open
the database using standard C file API rather than using the Storage
objects and so requires that the database be in the Xap or isolated
storage and cannot access a database on the SD card (this is
definitely the case for SQLite for Windows Store apps).
Feedback from SQLite SDK community:
Apparently it should be fairly straight forward to add support to the SQLite SDK for someone with some C++ skills (mine are a bit rusty!):
Replies:
http://www.mail-archive.com/sqlite-users#sqlite.org/msg81059.html
http://www.mail-archive.com/sqlite-users#sqlite.org/msg81060.html
To my original question:
http://www.mail-archive.com/sqlite-users#sqlite.org/msg81055.html

From your comments, it sounds like a very different approach would work better.
Your requirements seem to be that the end user is the one responsible for putting the data on the card using their desktop/laptop. Then plugging the card into the phone.
If that's the case then it seems the best solution would be to provide a regular desktop app that grabs the images in a zip file then performs an unzip operation onto the destination card. Essentially, the app takes care of the operation.
If you need any meta data about those images, then a json or xml file should be included.
This should be far simpler than dealing with a database on a read only SD card.

The solution that worked for me was to take OpenMCDF and adapt it to work on Windows Phone 8. I've made the adapted OpenMCDF-wp8 solution available on GitHub: https://github.com/gavinharriss/OpenMCDF-wp8
I've also made my workaround to the Windows Phone 8 bug that prevents Seek() from working correctly with the Stream returned from the ExternalStorageFile class: https://github.com/gavinharriss/ExternalStorageFileWrapper-wp8

Related

GUI for video files in the Windows Phone Isolated Storage

I'm currently working on a Windows Phone (8.0) application that can record video's. I want to save multiple video files in the Isolated Storage, but i can't find a way to view these saved files in a nice graphical interface with thumnails and information about length or size (much like the Windows Phone Camera Roll).
Could someone help me with this? There doesnt seem to be a lot of documentation on viewing the video files from the isolated storage.
Maybe it's something stupid, but i'm relatively new to developping for phones.
Thanks in advance!
1) I am not clear about your requirement but if you want see the Isolated Storage files in your machine you can use "Windows Phone Power Tools". For more info visit : http://msdn.microsoft.com/en-us/library/windows/apps/hh286408(v=vs.105).aspx
2) If you planning to make your own video gallary in Windows Phone app
Use AudioVideoCaptureDevice class to record videos and implement "PreviewFrameAvailable" event of it.
In that event, implement videoCaptureDevice.GetPreviewBufferArgb(argbPx) method.
For the size of video, when your read file from IsolatedStorage, you will get bytes array for data. That is the size of file. Covert it to Mb, Kb, etc format you want.

Windows Phone persistence options other than SQLite

What are the alternative persistence mechanisms for persisting some lightweight data in a Windows Phone application being written in C#? (can a XML file be used?)
This application targets both WP7 and WP8. Links to samples for the provided alternatives would be appreciated.
There are a couple options:
Put an XML file in the local storage folder of your app
If it is Key-Value pairs, use ApplicationData.Current.LocalSettings to store it.

merge sound file audio and record in Widows 8 Metro Windows Store application

I have two sound files that I need to merge. One is an audio file and the other is a recording file.
I am using c# to build a Metro Style App. Is there any libraries or any functionality in .net I can use to complete this?
Take a look to NAudio, I don't know if they have a version for Windows store apps.
An option could be to write .net web service that uses NAudio to do the job of merging the audio files and send it back to your app.

Windows 8 Metro Style App - Editing Word Documents

I am trying to read/write to a word (.docx) in a W8 metro app. For normal .NET Applications there are many libraries, but non of them are avaliable for Windows Store apps (e.g. Open XML SDK 2.5 is not supported in RT Apps).
The only way, it might work is via the xml document using Windows.Data.Xml.Dom which is going to be a lot of work. Has anyone accessed word documents with the Windows.Data.Xml.Dom (or any other library) and would like to share his code?
I don't have any first hand experience, but I'd take a look at the following two alternatives before falling back to raw XML processing:
Your best bet could be DocIO from Syncfusion. It's not free but the price is really reasonable considering how much work it could save you. And there's even a free beta available.
Chris Klug created a simple OpenXML library for Silverlight. You could check if it does what you need and then try porting it to WinRT since the source is available.

Writing files to an Android in C#

I am writing a Windows Forms application in C#, and I want to copy files from a directory on my C:\ drive into the "Computer\SPH-D710\Phone\Music" directory on my Android phone. That music path I just copied and pasted from Windows Explorer to this post, but C# does not recognize it as a valid directory, probably because there is no "C:\" or the like.
What is a C# command that can write a file to an Android?
It appears your phone is connected as a MTP device (media transfer protocol). It is not as simple as a file system access (USB mass storage). Read these series of blogs on how to do it, its not a simple file copy.
https://learn.microsoft.com/en-us/archive/blogs/dimeby8/sending-mtp-commands-through-wpd-part-1-without-a-data-phase
https://learn.microsoft.com/en-us/archive/blogs/dimeby8/sending-mtp-commands-through-wpd-part-2-data-to-the-device
https://learn.microsoft.com/en-us/archive/blogs/dimeby8/sending-mtp-commands-through-wpd-part-3-data-from-device
Beware you will be diving into some unmanaged code for this.
The .NET libraries used to store files won't really care where they are saving the file. Your Android device is seen as a USB storage device (as long as USB storage is turned on from the phone's point of view!). I recommend that you put some of your C# code up so that we can potentially spot an error in the routine that you are running to actually save the file to the phone.
As a quick example - your C# code will likely want to look something like this:
string filePath = #"G:\Music\MySong.mp3";
System.IO.File.WriteAllBytes(filePath, mp3FileContent);

Categories