expo fingerprint is not work in many android model?

hello,
i am getting issue when i am access fingerprint from old Samsung or many other MeiZu device so there is any api or other things so i can access fingerprint scanner in old device ?
And Does Expo support FingerPrint scanning for Samsung and MeiZu api ? or any other way to include this api in my application?
Thanks is advance.

@chintan_savjiyani hey! Thanks for using Expo.

Can you share any code example of what you’ve tried? Have you followed https://docs.expo.io/versions/latest/sdk/fingerprint?

1 Like

Yes, i am followed docs and i am make one component for android it as follow , it work for most of device but it not work for some old android device which fingerprint api is made by there manufacture like Samsung and MeiZu api so is there any solution for this devices ??

class AndroidScanner extends Component {
/**
* For showing scanner initially.
* @param props
*/
constructor(props) {
super(props);
this.state = {
showScanner: true,
};
}

/**
 * For toggeling scanner.
 * @private
 */
_toggleScanner() {
    this.setState({showScanner: false});
}

componentDidMount() {
    Expo.Fingerprint.hasHardwareAsync().then(response => {
        hardware = response;
    });
    Expo.Fingerprint.isEnrolledAsync().then(response => {
        enrolled = response;
    });
}

authFunction = () => {
    if (!hardware || !enrolled) {
        let message = !hardware ? 'This device doesn\'t support fingerprint scanning.' : !enrolled ? 'No fingerprints registered.' : 'App has no permission.'
        Toast.show(message, Toast.SHORT);
        return;
    }

    if (this.state.showScanner === true) {
        this._toggleScanner();
        try {
            Expo.Fingerprint.authenticateAsync().then(response => {
                if (response.success) {
                    Toast.show("Auth successful!", Toast.SHORT);
                    this.props.onPreferences(userPreferences);
                    this.props.onLogin(decryptText(getAuthKey));
                }
                else if (response.error === 'app_cancel') {
                    return null;
                } else {
                    this._toggleScanner();
                    Toast.show("Authentication Failure. Please Try Again!", Toast.SHORT);
                    Alert.alert("Authentication Failure", "Please authenticate to login.", [{
                        text: 'Ok',
                        onPress: () => {
                            this.props._toggleAndroidScanner()
                        }
                    }], {cancelable: false});
                }
            });
        } catch (error) {
            //if Finger scan will fail.
        }
    }
};

render() {
    {
        setTimeout(this.authFunction, 1000)
    }
    return (
        <View>
            <View style={androidScannerStyles.outerView}>
                <Image source={require('../../assets/finger_print.png')}/>
                <Text style={androidScannerStyles.fingerPrintStyle}>Place Your Finger</Text>
            </View>
        </View>
    );
}

}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.