简体   繁体   中英

How to get variable data passed from java class to native script jar file using javaScript

This is how I pass data

SharedPreferences pref = getApplicationContext().getSharedPreferences("FingerPrint", 0);
                            SharedPreferences.Editor editor = pref.edit();
                            editor.putString("fingerImage", encodedWsq);
                            editor.apply();

And I want to access "fingerImage" data to my nativescript project, that is java files are exported to jar file.

Perhaps you could directly use the application-settings NativeScript module (which is using SharedPrefferences behind the scenes) to set & get the values.

TypeScript example

import { setString, getString } from "tns-core-modules/application-settings";
setString("fingerImage", encodedWsq);
const myString = getString("fingerImage");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM