How to safely store json data in an Android phone?

I am developing an Android application in phonegap. I have to store json data that should be protected. Json contains authentication keys and tokens, so it should not be disclosed. Therefore, I cannot store it in any local javascript repositories. Is there any other way to safely store data?

+4
source share
2 answers

It is better to use the general Android setting, you can install it with a plugin. Here are the steps:

1 In your javascript add this

function storeJSON(JSON_String){

      cordova.exec(function() {
           //CALLBACK SUCCESS
        }, function(error) {
           //ERROR CALLBACK                    
        }, "YOUR_CUSTOM_CLASS", [JSON_String,"SET"]);
}

function getJSON(){

      cordova.exec(function(Json) {
           //CALLBACK SUCCESS
           alert(Json);
        }, function(error) {
           //ERROR CALLBACK                    
        }, "YOUR_CUSTOM_CLASS", ["","GET"]);
}

2 Create the Java class YOUR_CUSTOM_CLASS. Download

3 In config.xml add this

<feature name="YOUR_CUSTOM_CLASS">
     <param name="android-package" value="yourpackage.YOUR_CUSTOM_CLASS" />
</feature>
+5
source

, sqlite DB, , check https://github.com/lite4cordova/Cordova-SQLitePlugin - Sqlite Android

0

Source: https://habr.com/ru/post/1534621/