Storing data on user's phone - windows-phone-7

What would be "best practice" for allowing the user to store data for my application on his phone, using the same application?
For example, my app has a database of images+short audio. I want to allow users to expand said database by using the camera to take a photo and then save some audio along with it.
On MSDN it says
With Windows Phone OS 7.1, you can store relational data in a local database that resides in your application’s isolated storage container
But the rest of the app doesn't need 7.1, so it would be great if I could use this database/storage on 7.0 as well.

Microsoft has done a good job of upgrading devices, so unless you have a core group of users who you know can't upgrade for some reason, you should definitely target Windows Phone 7.1. (It's not like Android where you probably want to use an older SDK for greater compatibility.)
I have a similar app, in that it stores a library of images, audio files and data about those resources. What I've chosen to do is store the images and audio by themselves and then use the built-in SQL CE database to hold metadata about the resources (i.e. file paths and file names for the images and audio files, captions for the audio files).
It's probably possible to shove binary data into the database, but I would stick with storing it straight in isolated storage. The database is pretty fast, so it won't hurt the performance of your app.
If you really need to support 7.0, you can serialize your metadata as XML and then write it to isolated storage. This is what I did before the 7.1 release. Data access is likely going to be faster from the database than it would be if you need to read an entire XML file into memory, then parse it into objects.

Related

Save file in Windows Phone (pdf, csv)

I'm trying to find way to save files (pdf or csv) presented in application.
I want those files be available from outside the app.
From what I know it is impossible to save file to sdcard, only in isolated storage.
There is nothing like file manager in Windows Phone, right?
Maybe there is possibility to save file to some cloud from app?
Saving outside of your app doesn't appear to be coming until WP8.1.
In WP8 we do have a few alternatives.
Save the PDF locally and launch the associated app for viewing as per this SO answer.
Use a cloud service for saving the file. The easiest way I've come across is integrating with the CloudSix app for Dropbox. The details on how to integrate the nuget package are here. It's fairly simple if you just need fire-and-forget saving.

Using SQLite in Mac App

I am trying to look for a good tutorial/jump point to use SQLite in MacOSX App. I do have knowledge in iPhone development but never dealt with SQLite before, all my apps were enterprise lever where i talk to RESTFul server to post and get data, and all the sql stuff is at server side.
All my search attempts returned iphone results and some UI wrappers OSX, i guess there are less people out there that code for OSX than iphone :)
I am trying simply to make my app:
When it runs for the first time, checks and create a DB if it does not exist. I prefer to make the code invoke a sql script that will create the db if it does not exist, or if does exist it can check and make sure all tables, FK relations ..etc are correct. (I know how to do that script I just need the how to invoke in cocoa OSX apps)
Basic SQL stuff. INSERT/UPDATES/DELETE?
But before all this, is SQLite3 the correct approach for MAC OSX apps or I should stay with using plist files? Can the user "Normal" mess the state of SQLite3? are there any permissions issues that i have to worry about? I want my users just to launch the app and I will do everything in the background for them (I know I will support 10.8+ for this)?
Depending on your data needs you might consider using Core Data. It's not right for every situation, but it might be a good thing to check out. It can store data in XML, sqlite formats on the backend, so you can pick the right format depending on the data characteristics of your app.
If you know you want SQLite directly, FMDB is a good wrapper around it. I used FMDB a few years ago in a Mac app for a client and it worked pretty well.
Even if FMDB isn't your style reading the source may give you a good example of how the sqlite API works.
If you are an iOS developer then you are aware of Core Data, which is probably a better choice than raw SQLite for Mac Applications.

What is the best way to migrate online application to offline

I have a certain online application that generates reports(and prints them) based on some repository of information. Now I would like to make an offline application which is provides the same experience and in which the repository is pre-loaded into the users' computer. What is the best way to convert this online app to offline app. The first thing that came to my mind was setup a local server and database. This ensures the experience is consistent. But I'm open to other options, such as storing the data in a file system and then loading it via flash/flex based apps or C# or Java. The objective of this offline app is to provide the functionality(report generation) to users where internet is not feasible.
I am not sure about the windows aspect of your question, but if I was doing an offline web based page(s) I would be looking at a LocalStorage database (though it does have some downsides), but there are other alternatives such as WebSQL and IndexedDB.
If you have reports, do they still have value when they are out of date? Do you need to store the configuration of those reports or is it all just read only?
Shameless self promotion, I have a project that is designed to handle database synchronization, though it's not done, it's close. You can see it (with an ugly but very functional) demo at https://github.com/forbesmyester/SyncIt

windows phone 7 picture metadata

Is there a way to read picture data such as date picture taken, filename, GPS location and other information that is stored inside the images that stored in the medialibrary?
From what I can find the GDI+ components you would need for this are not currently available on the phone (or Silverlight for that matter). You can have a webservice provide this data to you or you can look into porting a desktop library, it seems some people here have had luck with that.
There is also a project called ExifLib that loads the metadata without the extra GDI+ overhead. http://www.codeproject.com/KB/graphics/exiflib.aspx

Is there a way to visualize records stored in an iPhone app via Core Data?

I have an app which, for good reasons, can only be debugged on a device. I'm using Core Data for the first time, and I'd like to be able to easily inspect the records that are stored by the app on the device.
I imagine that Core Data is by default backed by SQLite on the iPhone, so this question might be as simple as asking: "What's the easiest way to extract the SQLite database for an app installed by Xcode without jailbreaking it?"
Any experience someone could lend regarding this would be greatly appreciated.
Check out Core Data Editor. Just get the sqlite store from the device and use it with CDE. Costs 20 bucks but I think it is worth it.

Resources