Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FingerprintAuthenticationDialogFragment NullPointerException start nasirku #17

Closed
mendreuk opened this issue Apr 5, 2017 · 5 comments
Closed
Assignees
Labels

Comments

@mendreuk
Copy link

mendreuk commented Apr 5, 2017

Kdyz nastartuju Equa appku v orientaci na sirku a mam v aktivaci zapnuty fingerprint, tak to spadne pri otevirani dialogu na to, ze tam chybi context. Na vysku to normalne funguje.

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.Context.getColor(int)' on a null object reference
    at io.getlime.security.powerauth.keychain.fingerprint.FingerprintAuthenticationDialogFragment$5.onShow(FingerprintAuthenticationDialogFragment.java:233)
    at android.app.Dialog$ListenersHandler.handleMessage(Dialog.java:1343)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6077)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
@petrdvorak
Copy link
Member

Juraj, I will have a look tonight but if you managed to check the issue faster, it would help... :)

@petrdvorak
Copy link
Member

@mendreuk Hello, how do you call the code that crashes? Could you please paste some code snippet here?

@mendreuk
Copy link
Author

mendreuk commented Apr 5, 2017

Here is a simplified LoginActivity which crashes inside authenticateUsingFingerprint() method when resumed in landscape orientation. The exception is above.

public class LoginActivity {

    @Override
    protected void onResume() {
        super.onResume();

        openFingerprintIfAvailable();
    }

    private void openFingerprintIfAvailable() {
        if (hasBiometryFactor()) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                ApplicationEquaBank.getPowerAuthSDK().authenticateUsingFingerprint(this, getFragmentManager(), getString(R.string.login_fingerprint_title), getString(R.string.login_fingerprint_message), new IFingerprintActionHandler() {
                    @Override
                    public void onFingerprintDialogCancelled() {
                    }

                    @Override
                    public void onFingerprintDialogSuccess(@Nullable byte[] bytes) {
                        sendBiometryKey(bytes);
                    }

                    @Override
                    public void onFingerprintInfoDialogClosed() {
                    }
                });
            }
        }
    }

    protected boolean hasBiometryFactor() {
        boolean hasBiometryFactor = false;
        if (isFingerprintAuthAvailable()) {
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
                hasBiometryFactor = ApplicationEquaBank.getPowerAuthSDK().hasBiometryFactor(this);
            }
        }
        return hasBiometryFactor;
    }

    protected boolean isFingerprintAuthAvailable() {
        boolean isFingerprintAuthAvailable = false;
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
            isFingerprintAuthAvailable = FingerprintUtilities.isFingerprintAuthAvailable(this);
        }
        return isFingerprintAuthAvailable;
    }

}

@petrdvorak
Copy link
Member

... I am sorry, this one was dumb, I was using incorrect context object.

@mendreuk
Copy link
Author

mendreuk commented Apr 6, 2017

Ok, works now, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants