Device Library

Device Info Service

Introduction

DeviceInfo Service is used for getting device specific information like fiscalID of IMEI number

Usage

Include the library in your project

1) Get DeviceInfo.aar file. Download lastest version of the .aar file from example project's libs folder. 2) Make sure you included the aar lib in your project. It can be done in /app/.build.gradle file like this:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
    ...
}

Reading Device info

Create an instance of DeviceInfo class. It is recommended to reuse this instance when possible instead of creating a new one each time.

DeviceInfo deviceInfo = new DeviceInfo(this);

In order to get a particular field, call related function on deviceInfo object.


deviceInfo.getImeiNumber(new DeviceInfo.DeviceInfoResponseHandler() {
    @Override
    public void onSuccess(String result) {
        imeiNumberText.setText(result);
    }
    @Override
    public void onFail(String errMessage) {
        imeiNumberText.setText(errMessage);
    }
});

To get multiple fields with a single call, use getFields method.


deviceInfo.getFields(
    fields -> {
        if (fields == null) return;
        // fields is the string array that contains info in the requested order
        Log.i("Example 1", "Fiscal ID:   " + fields[0]);
        Log.i("Example 2", "IMEI Number: " + fields[1]);
        Log.i("Example 3", "IMSI Number: " + fields[2]);
        Log.i("Example 4", "Operation Mode: " + fields[3]);
        Log.i("Example 5", "Card Redirection: " + fields[4]);    
    },    
    // write requested fields
    DeviceInfo.Field.FISCAL_ID, DeviceInfo.Field.IMEI_NUMBER, DeviceInfo.Field.IMSI_NUMBER, DeviceInfo.Field.OPERATION_MODE, DeviceInfo.Field.CARD_REDIRECTION
);

Device Operation Mods;

package com.tokeninc.deviceinfo
public static enum PosModeEnum {
        VUK507,
        POS,
        GIB,
        ECR;
    }

Card Redirection Mods;

public static enum CardRedirect {
    NO,
    YES,
    NOT_ASSIGNED;
}

To see more examples, see the example project

Last updated