BlinkID / blinkid-android

Everything you need to add AI-driven ID scanning into your native Android app.
https://microblink.com/identity/identity-document-scanning/
438 stars 153 forks source link

How to implement Built-in fragment (RecognizerRunnerFragment) in a fragment (using android navigation components)? #225

Closed Morteza-Rastgoo closed 1 year ago

Morteza-Rastgoo commented 3 years ago

In the readme there is a sample for Built-in fragment (RecognizerRunnerFragment) that is implementing fragment inside activity. If I want to use it in a fragment what should I do?

SandraZiv commented 3 years ago

Hi @Morteza-Rastgoo

the current version of BlinkID SDK does not support this completely. In order to make it work you have to implement RecognizerRunnerFragment.ScanningOverlayBinder in your Activity and create a public method where you will initialize RecognizerRunnerFragment like this

public void initRecognizerRunnerFragment() {
        if (recognizerRunnerFragment == null) {
            recognizerRunnerFragment = new RecognizerRunnerFragment();
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.recognizer_runner_view_container, recognizerRunnerFragment)
                    .addToBackStack(null)
                    .commit();
        }
    }

This method should be called from your fragment ((YourActivity)requireActivity()).initRecognizerRunnerFragment();.

We are aware that this is not the best approach and will try to fix it in one of the next releases.

Best regards, Sandra

Morteza-Rastgoo commented 3 years ago

Thanks for your fast response. I'd problems with that approach as the activity should be involved in the current fragment's logic and should implement listeners to listen to the results. So, It would be great to change the functionality to support for fragments alone and leave the activity out of this process.

SandraZiv commented 3 years ago

Hi @Morteza-Rastgoo

yes, you are right and we are sorry for the issue. We will let you know as soon as it will be fixed, unfortunately, we can't fit it in our next release (v5.8.0), but it will be selected for one of the future releases.

Best regards, Sandra

Morteza-Rastgoo commented 3 years ago

Thank you! it would be great.

krizaa commented 1 year ago

This issue was closed because it has been inactive for such a long time. If the issue persists, please open a new one.