Skip to content

Library for passcode generation on different mobile apps.

Notifications You must be signed in to change notification settings

refactor-droidyy/mifos-passcode

 
 

Repository files navigation

mobile-passcode

Library for passcode implementation along with an optional additional feature to ask for passcode when your app resumes from background. (Works with minSDK >= 15)

Usage

In order to use the library

1. Gradle dependency

  • Add the following to your project level build.gradle:
allprojects {
	repositories {
		jcenter()
	}
}
  • Add this to your app build.gradle:
dependencies {
	implementation 'com.mifos.mobile:mifos-passcode:1.0.0'
}

Example

For a basic implementation of the PassCode Screen

public class PassCodeActivity extends MifosPassCodeActivity {

    @Override
    public int getLogo() {
        //logo to be shown on the top
        return R.drawable.your_logo;
    }

    @Override
    public void startNextActivity() {
        //start intent for the next activity
    }

    @Override
    public void startLoginActivity() {
        //start intent for the login or previous activity
    }

    @Override
    public void showToaster(View view, int msg) {
        //show prompts in toast or using snackbar
    }

    @Override
    public int getEncryptionType() {
        return EncryptionUtil.DEFAULT;
    }

}

There are 4 different types of encryption methods available with respect to our Android Projects:

  • DEFAULT
  • MOBILE_BANKING
  • ANDROID_CLIENT
  • FINERACT_CN

To access the passcode stored use PasscodePreferencesHelper

PasscodePreferencesHelper pref = new PasscodePreferencesHelper(context);
pref.getPassCode();// it will return encrypted passcode according to the encryption type chosen.

Asking for the passcode when your app resumes from background

Create a BaseActivity which should extend BasePassCodeActivity and extend this class for all your activities

public class BaseActivity extends BasePassCodeActivity {

    @Override
    public Class getPassCodeClass() {
        //name of the activity which extends MifosPassCodeActivity
        return PassCodeActivity.class;
    }
}

In your application class add:

public class MifosApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        //Initialize ForegroundChecker
        ForegroundChecker.init(this);
    }
}

For complete example click here

About

Library for passcode generation on different mobile apps.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 81.3%
  • Kotlin 18.7%