Using the Device Info API in Android

The Device Info API is used to return various device parameters, such as the device Operating System name and number, or the version number of the Appoxee SDK installed on this device.

You can also use the API to set device parameters, for example: increase the number of products purchased through this device.

Each Method is called through "Appoxee.methodName", since they are all public static methods.

Each call to the methods must be under AsyncTask. For example : 

Code Sample
new AsyncTask<Void, Void, Void>() {
 @Override
      protected Void doInBackground(Void... params) {

        String result = getDeviceOsName();
		//Do what is needed with the returned result...
        return null;
      }
     }.execute();

 

Device Info API Methods


getDeviceOsName

Returns the name of the Operating System installed on the device.

Syntax

public static String getDeviceOsName()

Returns

A string containing the name of the device Operating System.

getDeviceOsNumber

Returns the version number of the Operating System installed on the device.

Syntax

public static String getDeviceOsNumber()

Returns

A string containing the version number of the device Operating System.

getHardwareType

Returns the type of hardware installed on the device.

Syntax

public static String getHardwareType()

Returns

A string containing the type of the device hardware.

getDeviceLocale

Returns the device locale.

Syntax

public static String getDeviceLocale()

Returns

A string containing the device locale.

getDeviceCountry

Returns the device country location, in any of the following formats:

  • Country, State, City 
  • Country, State
  • Country

Syntax

public static String getDeviceCountry()

Returns

A string containing the device location.

getDevicePlatform

Returns the device platform.

Syntax

public static String getDevicePlatform()

Returns

A string containing the device platform.

getDeviceSdkVersion

Returns the version number of the Appoxee SDK installed on the device.

Syntax

public static String getDeviceSdkVersion()

Returns

A string containing the version number of the Appoxee SDK installed on the device.

getDeviceResolution

Returns the device resolution.

Syntax

public static String getDeviceResolution()

Returns

A string containing the device resolution.

getDeviceDensity

Returns the device screen density.

Syntax

public static String getDeviceDensity()

Returns

A string containing the device density.

getInAppPayment

Returns the total sum of all payments made through the application.

Syntax

public static Double getInAppPayment()

Returns

A decimal number indicating the total sum of all payments made through the application.

getNumProductPurchased

Returns the number of products purchased through your app on this device.

Syntax

public static  Integer getNumProductPurchased()

Returns

An integer indicating the number of products purchased.

increaseInAppPayment

Updates the total sum of all payments made through your app, by adding the given float value to the current in-app payment.

Call this method for each approved purchase.

Syntax

public static boolean increaseInAppPayment(float value)

Parameters

float value - the value by which the total in-app payment sum is to be increased.

Returns

true if the app payment was increased successfully; false otherwise.

increaseNumProductPurchased

Updates the total number of products purchased through your app, by adding the given integer value to the current number of products purchased.

Call this method for each approved purchase.

Syntax

public static boolean increaseNumProductPurchased(int value) 

Parameters

int value - the number to be added to the thetotal  number of products purchased.

Returns

true if the number of products purchased was updated successfully; false otherwise.