Deploying Files to IsolatedStorage in Windows Phone 7 - windows-phone-7

Hi everyone
I would like to know if it's possible to deploy my app assets directly to Isolated Storage once the app get deployed.
I'm currently extracting them from code but this make the app's first launch too slow and it will be declined once it's submitted to the marketplace.
I'm wondering if there is a nice trick to make the process faster
Thanks

There's no way to automatically deploy to IsolatedStorage on app installation.
There are a few things you can do to try and avoid a delay on first start up though:
Refer to files directly in the XAP where possible.
Split the assets into multiple dlls so that only those needed are loaded into memory.
Load content to IS in the background and prioritize this so that the resources are loaded as needed.
You should not need to load image or video files into IS just to view them.
You should only need to copy the XML files if they're going to be updated. If you just want to read some data this doesn't need to be done. Also, if the XML files just hold initial data/state this could be loaded from the assembly directed and only saved to IS when first persisted.

Related

Web Application Speed Performance

I'm using React and bundle with Webpack to create my web application.
My simple question is:
My bundling file is only about ~4.5mb, but my overall repo is ~20mb because of pictures and other assets. My question is does the performance(first opening up pages) of application only affected by my bundle size? or the whole repo?
And Also, what's considered an TOO large of repo or bundling? for average enterprise production application?
What your production app will probably use is what you generate inside the build directory. Sometimes this is only a bundle.js file (the images and styles will be inside), other times you can split the bundle.js file's images and styles in different files, so you would have to include that. It all depends on your setup.
4.5mb is not too much, although it will depend on your server performance too. It is completely normal if it contains all the dependencies. If you need to load some pages faster than the rest, you can split the bundle in multiple files so some parts of your app will not require all the bundle files. This is called code-splitting. You read more about it here.
Normally you will want some simple landing pages to load faster, and it would depend if your website is the mainly used by mobile phones (worse network connections) or laptops (normally using Wifi).

Appcelerator with expansion files

Has anyone successfully used expansion files with appcelerator? I have found the module that is supposed to let us work with them, however I am running into the problem of the .obb file being downloaded directly from the play store and then being downloaded again with the module. Aside from that I can't seem to get access to any of the files contained within the .obb using the module.
I have heard all of the woes of having a big app, so please don't just tell me to make a smaller app, my client has a large "library" that they want installed directly on the app. It consists of html files that call javascript files and images through relative paths.
Are expansion files even the way to go with this? Should I simply zip up my files and download them after, unpack them, and access them using the file system? I am just looking for a way to get these large files onto the device and access them as if they were in the resources directory of the app.
Any help would be appreciated. thanks!
I have an app that needs over 300 PNG images and text files (to populate a database with) and could not get the app small enough to put up on the Play Store. What I ended up doing was create a barebones app (enough to get the user started) then I download the files on start up. I didn't mess with zipping everything (the data is constantly being updated), but if the information you have is pretty static, you could zip it. Once the download successfully finishes and installs the data, it sets an app property (Ti.App.Properties.setInt) 0 is never ran, 1 is partial download and 2 is download is installed (you can do this however you want, but that's what I did).

Windows Phone 7 attach data to XAP File

I am working on an music application and after long testing I have came to the conclusion that for the firs run I have to Load in the XAP File the Levels Data instead of downloading it from a web service because it is faster and not so time consuming.
My question is if someone knows a method to read the file listing inside an application folder.
I have written a method that copies the data from one folder to the LocalStorage of the application (IsolatedStorage) and all I need is a way to read the content of the folder.
I have to mention that this is my first app for windows phone.
If the file is in the application folder - which means it is packaged up in the xap - you should be able to get the file using the Application.GetRourceStream like I've seen with apps that have local databases they package, but want to copy over to Isolated Storage after install.
Here's an example (from this page http://msdn.microsoft.com/en-us/library/hh202860(v=vs.92).aspx):
Stream str = Application.GetResourceStream(new Uri("appdata:/MyReferenceDB.sdf", UriKind.Relative)).Stream;
appdata: is what tells it to look in the application directory. Only other option is isostore:
So you have already copied the file from your xap resources to Isolated Storage, and you want to read the file back out of Isolated Storage? (Is there a reason you can't just load the data out of the xap, without copying it to Isolated Storage?)
Try this tutorial on files and Isolated Storage: http://www.windowsphonegeek.com/tips/all-about-wp7-isolated-storage-read-and-save-text-files (I recommend reading the whole thing, but I linked specifically to a page on creating and reading text files).
This question contains code for listing the files in your isolated storage, if you can't just hardcode your filename:
windows phone 7 File Listing IsolatedStorage

Coping files from desktop to Windows Phone 7 Isolated Storage

I'm new to Phone 7 development.
I am trying to create an application the will load all the DLLs that I have created from a set location on the phone.
I have a basic menu application that will load all the DLLs I have created and display a list of then to the user using reflection to get an Icon out of the DLL and a description.
I have the following code to get all the dll but its not working
Dim cPlugins As New PluginCollection
Dim temp As String = System.Reflection.Assembly.GetExecutingAssembly.GetName().CodeBase.ToString
temp = System.Reflection.Assembly.GetExecutingAssembly.FullName
Dim strFolder As String = System.IO.Path.GetDirectoryName(temp)
strFolder = System.IO.Path.Combine(strFolder, "DLLS")
For Each strFile As String In System.IO.Directory.GetFiles(strFolder, "*.dll")
cPlugins.Add(New Plugin(strFile))
Next
The above code doesn't work and keeps returning a file not found error.
Any help please?
To retrieve the DLLs as resources you'll need to add them as embedded resources (build action) in the projet/XAP file.
This will not require you to copy them to isolated storage.
If you were copying them to isolated storage then you could put htem there with isolated storage explorer but this would only work for testing. For the live app you'd need to include them in the XAP and then copy them to isolated storage. As you don't neeed them in isolated storage to open them as resources to extract images then it would be unnecessary effort.
If possible, you coudl make things easier for yourself in the WP7 app by not embedding the images inside a DLL but this may not be practical if you are using the same images/DLLs across projects on multiple platforms. Even if this is the case I'd recommend considering adding a build step to you WP7 app to extract the images once at design time. This will mean your app has to do less. It will therefore able to be faster, have less opportunity for bugs and provide a better experience to the user.
Edit:
The issue is the way you are trying to query the files in IsolatedStorage. There is no need to calculate the actual path of your isolated storage location. Instead you should use the IsolatedStorageFile.GetFileNames Method. You'll use it like:
Using store As IsolatedStorageFile = IsolatedStorageFile.GetUserStoreForApplication()
.... store.GetFileNames("/DLLS/*.dll")
End Using
The property Codebase isn't supported in Silverilght on the Phone. (See http://msdn.microsoft.com/en-us/library/system.reflection.assembly(v=VS.95).aspx) but you don't need to use this method to find the isolated storage location. Use the IsolatedStorageFile class instead.

Read a text file in WP7

in order to test my WP7 application with the emulator, I have to read a text file with a large input.
I have some problem to read it and to use the isolate storage.
More in details, the application is not able to read the file from my local disk.
How can i put the txt file into isolate storage?
Many thanks
Justin Angel has a blog post showing how to automate the emulator (for testing purposes) and it also includes details of how to copy files directly to the isolated storage for an app:
http://justinangel.net/WindowsPhone7EmulatorAutomation
See this question:
Open a project file in phone7
I give an example of how to access a file (resource) from your project and also how to copy that resource to isolated storage and access it as needed.
A simple way to test this would be to package the file in the XAP. If you don't need to modify the file while your app is running you can leave it there and just read it. Alternatively you can load it down to isolated storage at a convenient time while your app is running.

Resources