@bnnsoftvn/mobile-sic-sdk v3.0.2
@bnnsoftvn/mobilesdk
B1 Tạo mới một Project React Native
$ npx react-native init MyApp
$ cd MyApp
$ npm i @bnnsoftvn/mobile-sic-sdk
$ npm i @bnnsoftvn/react-native-biometrics-sic
$ npm i react-native-device-info
B2 example code
import { GenerateSad_V2 } from '@bnnsoftvn/mobile-sic-sdk';
import DeviceInfo from 'react-native-device-info';
import React, { useState } from 'react';
import { TouchableOpacity, Text, View, StyleSheet, ActivityIndicator } from 'react-native';
const App = () => {
const [loading, setLoading] = useState(false);
// Async function to fetch data
const handlePress = async () => {
setLoading(true);
try {
var uniqueId = DeviceInfo.getUniqueId();
var json = {
"userid": "122280280231231",
"deviceid": uniqueId,
"format": 1,
"sad": "eyJ0cmFuc2FjdGlvbl9pZCI6ImQ3YWUxM2FiLTVhNDQtNGUxMS1hOGZjLWEzOGZjODgxZThmNCIsIm9yaWdpbmF0b3JfaWQiOiJOZ3V54buFbiBWxINuIFRlc3QiLCJ1c2VyX2lkIjoiUElEWTlKVlhKT0hYN04iLCJjZXJ0aWZpY2F0ZV9pZCI6Ijg3NTkwQjI1NTkyNjQxNjIyQkQ2RTQ0ODgxNjEzNDY2MkQxNzZBRCIsInNhbHQiOiJiMjk3N2ZhMy1hZWUzLTQyZDYtYmE2Zi02OTQ2ZmZmZTFiNzMiLCJkZXZpY2VfaWQiOiJkNWs5MmJYdlFoZXVuWFhEcUdtSG44OkFQQTkxYkc1SDFLbjg3Z293TnM1U0RGSDRrc0ZQWXBUbjBjZ1U2WmgtdERBdFdnOHdPdmhnX3RBZ3N0X1RlRmNxa3NxWXc5WXFXekg5WmdoV3drQ2dodmpTaWx3YnE5a1lKWVFjY1VBYkJrZDlGaE9IejdrQzJvIiwibnVtYmVyX3NpZ25hdHVyZXMiOjEsImRvY3VtZW50cyI6W1tbW11dLFtbXV1dXSwidmFsaWRpdHlfcGVyaW9kIjp7InZhbGlkX2Zyb20iOltdLCJ2YWxpZF90byI6W119fQ"
}
console.log(GenerateSad_V2);
var sig = await GenerateSad_V2(json);
console.log(sig);
} catch (error) {
console.log('Error fetching data');
}
setLoading(false);
};
return (
<View style={styles.container}>
<TouchableOpacity style={styles.button} onPress={handlePress} disabled={loading}>
{loading ? <ActivityIndicator color="#fff" /> : <Text style={styles.buttonText}>Fetch Data</Text>}
</TouchableOpacity>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
button: {
backgroundColor: '#007BFF',
paddingVertical: 12,
paddingHorizontal: 20,
borderRadius: 8,
},
buttonText: {
color: '#fff',
fontSize: 16,
},
});
export default App;B3 Start App
$ npx react-native start
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago