I'm new to WP8.1 developing so this might be a newbie question:
I'm writing an app that have some settings, so i'm using these APIs:
var applicationData = Windows.Storage.ApplicationData.current;
var localSettings = applicationData.localSettings;
As i can see from emulator everything works well if i save a value and then get it out later, even if i close the application with task manager (holding the back button of the emulator): if I run the app again it has the correct values saved.
But if I shut down the emulator and re-launch the app from Visual Studio it starts with default values.
Is it because the emulator is freshly created every time and my app installed every single time or something is wrong with my ApplicationData usage?
I mean: if I use a true phone with these settings (don't have one now) will the customized settings saved even if i turn off the phone? Or I have to use some more "deep" API to permanently save an application setting?
Thank you for your help!
Gianluca
According to this link http://sviluppomobile.blogspot.com/2013/01/saving-windows-phone-8-emulator-state.html, yes, Windows Phone emulator does not save its state, so every time you start the emulator, you get a "new" fresh system as if you turned on a real phone for the first time.
On the other hand, when you use a real device then the state will be preserved and you will not loose your data when you restart the phone.
In 8.1 emulator you can go on Additional Tools -> chechpoints and save the current configuration of your emulator (set as default one if you want it next time you open the emulator)
Related
so I have created a reminder app using React Native and Expo.
I followed the Expo docs which require that you set your app up with Firebase Cloud Messaging even if you're only sending local, scheduled notifications. I also added the exact alarm permission to the android manifest using app.json. Also, the AndroidImportance for the app's notifications channels is set to MAX. Lastly, the Android priority for the notification itself is also set to MAX, as well.
Everything in the app works great, except for one thing:
When the Android device is inactive for a while, the scheduled notifications do not appear at the scheduled time.
I am assuming this is because the device has entered doze mode which is part of Android's battery optimization features. Doze mode can delay notifications.
I am just surprised-- what is the point of a local, scheduled notification feature if it can't even get past doze mode?
I could be overlooking a solution. Does anyone have any ideas? If not, I may have to rewrite a lot of code so that the notifications are not local.
Thanks!
I first tried setting the notification's priority to high, and the notification still wouldn't appear during inactivity. So then I switched the notification's priority to MAX, and that didn't seem to work either.
There is a package on npm for disabling battery optimization in react native apps, but apparently that can get you banned by google, which I'd rather not get banned.
EDIT: One other relevant detail is that when I was at the stage of development early on where I was testing in the Expo Go app, scheduled, local notifications were not affected by doze mode at all. I'd schedule one in the evening, forget about it, and it would come the next morning. I'm wondering if this as an indicator of what needs changing??
So it turns out there are two places where you can set priority to "Notifications.AndroidNotificationPriority.MAX" --
Once when you send the notification, and once when you handle the notification. I had only set it when sending the notification.
For info go to docs Ctrl + F and search for "AndroidNotificationPriority"
Each time appp is opened, user recieves data in Ajax request, it is stored in browser localStorage, and when user next time opens app, it shows localStorage values from the very first time they were set. Seems like after initially setting localStorage items, they won't change. They work fine during app, but when opening it again, there still are the very first values.
App is built on iOS and Android using Cordova latest version (as of current), using jQuery Ajax requests and browser localStorage.
Example:
User opens app for first time.
Access token is requested and is saved in localStorage localStorage.setItem('token', '1234');
User uses app for some time and exits.
Next time user is opening app and gets token, it is again saved in localStorage localStorage.setItem('token', 'abcd');
User uses app, then quits.
Again opening app and checking localStorage, the stored access token is 1234 from the first time.
iOS considers any data stored inside the Webview of an app (HTML5 Local Storage, WebSQL, IndexedDB, Cookies, etc.) be temporary/cache data.
Therefore, if an iOS device starts to run low on space, iOS may decide to wipe the Webview data to recover space.
When this happens, the app name on the Home screen changes to "Cleaning..." and when you next launch your app, all your Webview data is gone.
For this reason, I moved from storing data inside the Webview of Cordova apps to storing it in a native SQLite database using the cordova-sqlite-storage plugin.
The native DB file is considered "proper" data by iOS so is not wiped when an iOS device runs low on storage space.
I empirically tested both scenarios by filling an iPad with movies until it was running low on space, triggering iOS to start its "cleaning" of installed apps.
For more info, see this related issue.
I have used the Ionic framework to build my App and have been thinking about the local storage and how it works. One of my users phone storage is capped out with photos and video content, and I was wondering how this would effect an HTML5 App that uses local storage.
I decided to test it by purchasing a cheap phone with only 2GB internal storage, and filling it up with random Audio files from my PC. I have managed to get Windows to think there is 0kb left in internal storage, yet my Ionic App can still add data to local storage.
Does anyone know why this is, or have any input as to where local storage actually is saved? I sort of expected it to just store in the browsers App Data, but maybe it is somewhere else?
EDIT
Have just looked at the phone storage and it says there is still 99.9mb that is un-used. Android must not let Windows fill all of the device's storage. Does anyone still have any knowledge on what would happen if I managed to fill this last 99mb??
OK.. I cleared my App data and then managed to fill up the last 99mb of space by duplicating more files using the File Commander App on the phone.
I then opened my Ionic App and logged in (which downloads about 1.5mb of App data) and the App seemed to work fine (as everything was stored in RAM at the time). Once the App closed and I re-opened it, all the stored data was gone (as there was no space to move it to from RAM I am guessing)
End result: App works fine in RAM but if there is no space in localStorage, it will not error or tell you it didn't work, it will just not save the data.
Note: I have not tested this when there has been existing data in App, and trying to add to it which would take the phone over the storage limit. Im unsure if this would corrupt the existing data or just not let you add to it.
I am building a chrome extension which requires you to sign in to chrome before using it, post which you could save some values (which I store it in the Sync storage) and the same is expected to get Synced whenever I Sign into chrome from some other machine using the same Sign in info.
I tested the extension and the info is being stored successfully on the machine where i am saving it. But the same info is not synced to the other machine. Just to make it clear,I have also installed the extension in the other machine's chrome as well.
I have used the following code in the background js for syncing purpose-
chrome.storage.onChanged.addListener(function(changes, areaname) {
if(areaname=="sync")
{alert('Storage Changed' + changes);}}
so that I get an alert indicating that the event is getting fired.
I don't get this alert in the other machine; indicating the sync didnt happen.
I looked up Sync settings,it shows that the sync just happened. But there was no alert.
Is it so, that we can test syncing during development of the extension ?
I have been through Does-chrome-app-id-for-extensions-affect-sync-storage
Does the App Id has to do anything with it ??
UPDATE - I found the answer. Let me elaborate how I did it. -
This page developer.chrome.com/extensions/packaging explains how to package and extension manually. Please go through that before proceeding.
Step 1 - I deleted the extension that I had installed in both the machines.( I had installed it using the Load unpacked extension option before)
Step 2 - I followed the link above and made a manual package file with .crx and .pem file
Step 3 - While I was signed in into the two machines using the same gmail account, I shared and installed this .crx file by drag-dropping the file into the browser. (It asks for confirmation and proceeds to install)
Step 4 - After following Step-3 on both the machines, I now have my extensions installed in both browsers.
Step 5- I saved values using my extension in one browser and voila, after a while, it appeared in the other machine.
Step 6- But One important thing though, the data was synced automatically without the alert that I wanted to display-
if(areaname=="sync") {alert('Storage Changed' + changes);}}
So I assume that this listener code was not important in my case anyways. Hope this helps other guys looking for the solution.
I'm developing a web app that shows a counter, and when the counter comes down to 0 I want to notify the user(The counter is on a server, so there won't be a problem with reloading the page).
If the user is on a computer, I'm using a popup for the notification, but if the user is on an Android device, I would like the notification to be shown even if the browser isn't open.(I'm using AngularJS if that would be any help)
Is there a way to do this? I rather not build a special Android app.
Thanks.
//G
I'm afraid no, there is no way to do that. When any android application is not active is... not active, frozen. The browser is not a service, so as far as I know it won't process anything while in background. Even it's possible the OS close the browser if it needs more memory than is available.