preloader

How to Build Mifos Android App

Mifos provides mobile app for daily collector. On this daily collector app there is a provision to put in the end-point to connect to for getting the data. This enables to use the same app for different institutions by changing the connection URL end-point where the service is hosted. We can add this end-point as the default URL and build the app. Below we will provide the necessary steps for building Mifos Android App.

Changing App Connection End-Point

The first and foremost thing is to add the end-point destination URL for the app to connect to. For this update the BaseURL.java file.

public static final String PROTOCOL_HTTPS = "https://";
public static final String API_ENDPOINT = "<Server-Endpoint>";
public static final String API_PATH = "/fineract-provider/api/v1/";
public static final String PORT = "<Port>";
Change the <Server-Endpoint> & <Port> to the address server location and port. If you are unsure of the URL, you can contact your official Mifos service provider to get the details.

Backward Compatibility – Connecting to Older Fineract

if you are using a older version of fineract then it is highly probable that the authentication support is via URL params and not via body params. In this case the username/password combination needs to be passed via the URL path. This needs changes in two files and need to create a new file.

Create file LoginPayload.java and copy the below code

data class LoginPayload (

    var username: String? = null,

    var password: String? = null
)

In AuthService.java replace the authenticate method with the below code:

@POST(APIEndPoint.AUTHENTICATION)
Observable<User> authenticate(@Query("username") String username,
                              @Query("password") String password,
                              @Body LoginPayload loginPayload );

And then in DataManagerAuth.java replace only the function login with the below code

public Observable<User> login(String username, String password) {
    LoginPayload payload = new LoginPayload();
    payload.setUsername(username);
    payload.setPassword(password);
    return baseApiManager.getAuthApi().authenticate(username, password, payload);
}

Lastly edit the file HomeActivity.kt, replace the code

navController = Navigation.findNavController(this, R.id.nav_host_fragment)

with the code below

val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
navController = navHostFragment.navController

Leave a Reply

Your email address will not be published.