Cordova localstorage not persisting - windows-phone-7

I am developing an Hybrid Mobile app using Windows Phone 7 sdk and phonegap. Using Cordova local storage I am storing value. The stored value does not persist If I close the app and launch again in windows phone emulator. Anybody used local storage or alternative persistant storage in windows phone shares idea would be great.
window.localStorage.test = "Some test data";
console.log(window.localStorage.test) //It prints result but does not persist

I believe the correct syntax is:
window.localStorage.setItem("test", "Some test data");
console.log(window.localStorage.getItem("test"));
Assigning properties appears to work simply because javascript allows you to attach new properties to objects.
Original Answer Are you closing the emulator between executions? The emulator clears its user state when you close it.

Related

Uwp - Invalid value for registry

I have an uwp app, which is being distributed using SCCM and every time after a new release is distributed, when a user tries to open the app using the protocol (Eg. Appx:\) an error is displayed by Windows saying "Invalid value for registry" . If the user opens the app using the ícon on the startup menu, it opens without problem and after that there is no problem openning the app using the protocol anymore.
Anyone have any idea why? And how to solve it ?
The uwp app is built over windows anniversary update.
Thank you

Can we perform navigation between Windows Phone Silverlight 8.1 project page and a Windows Phone 8.1 project page under same solution?

I am working in Windows Phone application in which I have two projects one is Windows Phone Silverlight 8.1 and another is Windows Phone 8.1. I want to navigate from a xaml page in Windows Phone Silverlight 8.1 project to Windows Phone 8.1 Project on a button click and then return back to the page. Is there any possible way to do that?
Thanks,
Ekta
Regardless of their types, there is no way to directly navigate to a page in another app on Windows Phone. Your best option is to declare a URI association in the target app that the source app can launch with - see here for details.
As for returning to the source app, you should try to leverage the system back key if at all possible. However, if it's not going to be obvious to the user that she should hit the back key, you have two options:
Use Application.Current.Exit() to close the target app, which will
return the user to the last session in the back stack, which should
be the source app (unless the user task-switched in the interim).
Register a URI association in the source app and navigate back to
that from the target. Note that the process of registering and
handling invocation of URI association activation is different in WP
Silverlight apps - see here.
The difference between the two approaches is that if you Exit, the target app will be terminated and removed from the back stack whereas launching a URI association results in a new forward navigation and will leave the target app in the back stack.

Implementing error logging in windows phone 7 app? [duplicate]

I don't have a WP7 device yet. Everything is functional in My App on a Simulator, but when my customer test it, app does not function at all. e.g. VDO is not playing.
Is there a way to get a crash log from Windows Phone 7? (like iPhone).
You can easily create your own crash report. Basically this is what you have to do:
In your App class add an handler for the UnhandledException event
inside the handler prepare a log with everything you need (stacktrace, memory allocated, etc.)
use an email composer Task to send the report.
You can also check BugSense which is a cross-platform(iPhone,Android and Windows Phone) tool that collects and analyzes crash reports from mobile apps.
Disclaimer: I have developed the WP7 plugin.

for how long data in Isolated storage is persistent

I have read that data stored in Isolated Storage in wp7 is permanent.But I am a little confused about the term 'permanent'. I don't have wp7 device so I can't check this on a real device. I tried the emulator and everything is working fine until I close my emulator. I want to know if the same problem exists on the real device when the application is closed or the device is switched off.
On the device, the IsolatedStorage will keep your data, until you uninstall/delete the application. When you use an emulator, the "installed app" remains only until you close the emulator. Closing your emulator is equivalent to deleting your application.
In device Isolated Storage data is stored till the application is Uninstalled.
Whether it may IsolatedStorage data or Application Settings.
When you are using windows phone instead of emulator IS is persistent. But in emulator the story is different refer this question Automatic login process in Windows Phone 7.1 application

Erase IsolatedStorage from Windows Phone 7 emulator?

I am building a wp7 app. I am using IsolatedStorage. Sometimes, for testing purposes, I'd like to erase everything my app has put into IsolatedStorage. Is there a way to do this for the emulator, or must I do it programmatically?
You'll lose all isolated storage for all apps by restarting the emulator.
Alternatively, you could uninstall the app from the emulator via tap and hold on the app list.
If you did want to do this programatically the code is very simple:
using (var store = IsolatedStorageFile.GetUserStoreForApplication())
{
store.Remove();
}

Resources