DeviceAnalyser (Deprecated)

Get relevant information from an Android device.

The Device Analyser is capable of obtaining highly accurate geolocation data.

Runtime permissions

Instantiating the SDK

First, create an object of type DeviceAnalyser. This object is for you to configure all your business rules for the SDK:

DeviceAnalyser mDeviceAnalyser = new DeviceAnalyser.Builder(@NonNull AppCompatActivity activity)
    // see table allow
    .build();

Builder method

LocationInfo

LocationListener

LocationListener locationListener = new LocationListener() {
    @Override
    public void onSuccess(LocationInfo locationInfo) {
        //Success
    }
    
    @Override
    public void onFailure(Failure sdkFailure) {
        //Fail
    }
};

Example of use

deviceAnalyser = new DeviceAnalyser.Builder(this).build();
deviceAnalyser.getLocation(locationListener);

onActivityResult

Use the onActivityResult method to get the result of the user's interaction with the GPS activation request popup on the device:

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == Constants.REQUEST_CODE_OF_GPS_DIALOG) {
            switch (resultCode) {
                case Activity.RESULT_OK:
                    // Make a new call to the getLocation() method in case the user has activated GPS
                    deviceAnalyser.getLocation(locationListener);
                    break;
                case Activity.RESULT_CANCELED:
                    // User refused GPS activation
                    break;
                default:
                    break;
            }
        }
    }

Last updated

Logo

2023 © Caf. - All rights reserved