Cordova and Android 6.0 automatic restore issue - android

I am currently developing application using Cordova + Ionic for Android.
I use LocalStorage and PouchDB for data storing.
Recently I have discovered that Android 6.0+ has a feature to automatically restore apps once installed (even debug applications installed not from play store).
Every time I install app LocalStorage and PouchDB data gets restored which is not kind of behaviour I need.
I have read that developers have full control of that backup system, may tweak what gets backed up or if they want completely opt out of the system.
Question is how do I disable it in Cordova, is there some kind configuration switch, I did not find any.

Related

How to install a PWA with Android WebView/TWA

Scenario
I have an existing native android app in which I want to add some new features. These features have already been implemented as a PWA because some users needed to use them directly from the web.
I want to be able to open the PWA with an Android WebView (as if it was part of my native application) and install it 'locally'. With 'locally' I mean that the PWA should not be visible as an app in the phone, it would just be part of my existing native app. In a way, what I'm trying to achieve is a king of "plugin" system, where I could have extra features that the user can install to the native app.
Where am I stuck?
Opening the PWA with a WebView is fairly straight forward. The part that I am unable to do is installing the PWA. Maybe TWA could solve this issue, but I am not sure it is meant for that.
Moreover, ideally I would like to keep everything in a Fragment since I would like to have the toolbar and others created by the native app (that is why I've leaned more towards using WebView instead of TWA).
EDIT---------------
After messing around I was able to understand that it actually gets installed with WebView. Since I haven't been able to find any information about how it works online I've been researching it on my own.
First of all ServiceWorkerController is only available from Android 7 (24). I haven't been able to test if with Android 6 this can work or not due to the fact that I don't have any phone with that version and I can't update the WebView apk of my emulators for some reason.
Then, I found out that the webpage crashed in my newer emulators because the WebView apk installed was too low and didn't support some newer features. So another thing to take into consideration the WebView version installed. This apk gets installed separately from the Android version (it's as if it was an app on your phone). The solution to this is to just use a real device, because the apk is usually always up to date.
As you can see in the following picture the PWA gets installed inside the app folder and it also keeps all the info (databases, localstorage, sessionstorage, etc.) in there.
It is unclear how this data is handled (I created this question) but it appears to be at least in the following cases:
WebStorage.Instance.DeleteAllData()
App uninstalled
App Data Cleared
Clearing the Cache of the app doesn't delete the persistent data.
So now I would say that the question would be:
From which Android Version does the Service Worker install? Just from the Android version that has support for the webview apk version that supports Service Workers?
Does it depend at all on ServiceWorkerController? Or is it just a utility class to have more control over what happens?

What is an effective way to load data to test mobile app upgrades

We have a mobile app on iOS, Android, and UWP. Each release, we use the platform specific way to host a beta version. Then we install the production release of the app from the app store, add some basic data, and then install the beta version over the top to test version to version upgrades. However, this is not a sufficient test as the data is very simple vs testing a db upgrade for a user who has had the app for years with lots of data. It also doesn't cover v1.1 to v1.5, v1.2 to v1.5, etc tests. We can do those tests as well, but the loading of a good set of data is very time consuming.
What is a good way on each platform to load a very large simulated data set? As far as I can tell, I have no ability to replace the SQLite db on iOS or Android. How do people do this type of testing? Do you add the ability to pull the simulated data from your server and load it into the db? Other ideas?
There are not that many options to regression testing, you could try Appium to install/run multiple binaries and run your test scenarios to see if app behaviour is as expected.
checkout :
http://appium.io/docs/en/writing-running-appium/caps/

Refresh cache and data Cordova app

I develop an application with Cordova for Android and IOS.
However, when publishing an update, sometimes the application has bugs due to some data being cached. The problem is solved by emptying the cache and the data of the android application.
So I am trying to find out if it is possible to force the phone to dump this data during a new update (for major update).
Whether it's a feature from Google Play, or a feature in the application code?
Thank you in advance.
Cordially.

Load hybrid iOS and Android mobile app from server

I am using Ionic and Cordova to build a mobile app which will go on the iOS and Android stores. I have done this many times, and I really hate the process of having to update the app (specifically with Apple).
Would it be safe to dynamically load all of my templates and controllers from my server when the app loads, potentially caching them or having a server call to check if there is a new version? Basically, I would have all images and styles saved locally to the phone, but load the templates and controller code on app load.
And, if it was ok to do programmatically, are there any rules against this in Apple or Android's terms of use?
This is possible and there are tools like Cordova Hot Code Push to help you accomplish it. As long as you don't use this to break other app store review rules or significantly change the purpose of your app it's fine with Apple.

Converting android apps to blackberry : Updates lose stored data within the phone

I need my Android application to work in Blackberry platform and followed the following process (explained under the blackberry deve zone) to convert existing Android app to work in blackberry.
Runtime for Android apps
So I can create a .bar file and continue my work.
I am currently using the blackberry simulator with VMWare downloaded from following links.
BB 10 Simulator & VMWare
My Android app(Converted) works well in Blackberry but experiencing a small isuue and needs to get this clarified.
When I run the application for the first time, I need to store some user settings and also some information later with the app usage (within the phone itself).
So in android I used sharedpreferences and Sqlite DB to store a small amount of data within the phone. But when I do a modification in the code and and re-install it (basically Run the application from eclipse to update existing app) to the BB emulator without un-installing existing APP, it loses all the stored data within the phone.
Wonder if this issue (losing stored data when update App) going to continue in the similar way with marketplace (Blackberry world) updates as well. OR do I do any mistake here to lose the stored information when I run eclipse project to update the App in Simulator?
A giude in this would be really aprreciated. Thanks.

Categories

Resources