mobicontrol.apn

This namespace provides access to the APN functionality.
Since:
  • Version 1.4 (API level 5)

Classes

Apn

ApnConfiguration

ApnError

Members

static, readonly ApnStatusCode :object

This enumeration represents an error status code of mobicontrol.apn.ApnError.
Properties:
Name Type Description
UNKNOWN object The exact error could not be determined.
NOT_SUPPORTED object APN configuration is not supported on this device.
OPERATION_NOT_SUPPORTED object Specific APN operation is not supported on this device.
PROPERTY_NOT_SUPPORTED object Specific APN property is not supported on this device.
Since:
  • Version 1.4 (API level 5)

static, readonly MvnoType :object

This enumeration represents the MVNO type of mobicontrol.apn.ApnConfiguration and mobicontrol.apn.Apn.
Properties:
Name Type Description
NONE object APN configuration is not restricted to use on a particular MVNO or a subscriber account.
SPN object The value to match is an SPN value (Service Provider Name).
IMSI object The value to match is an IMSI value (International Mobile Subscriber Identity).
GID object The value to match is a Group Identifer Level 1.
Since:
  • Version 1.5 (API level 6)

Methods

static createApnConfiguration(apn, mcc, mnc) → {mobicontrol.apn.ApnConfiguration}

Create APN configuration.
Parameters:
Name Type Description
apn string Access point name, must not be empty.
mcc string Mobile country code, must consist of three decimal digits.
mnc string Mobile network code, must consist of two or three decimal digits.
Returns:
mobicontrol.apn.ApnConfiguration - APN configuration.
Since:
  • Version 1.4 (API level 5)
Example
const CANADA_MCC = '302';
const ROGERS_MNC = '720';
var config = mobicontrol.apn.createApnConfiguration('ltemobile.apn', CANADA_MCC, ROGERS_MNC);
mobicontrol.log.info(config.apn + ',' + config.mcc + ',' + config.mnc);

static getPreferred()nullable {mobicontrol.apn.Apn}

Get preferred APN.
Throws:
Returns:
mobicontrol.apn.Apn - Preferred APN, or null if there is no preferred APN.
Since:
  • Version 1.4 (API level 5)
Example
var apn = mobicontrol.apn.getPreferred();
if (apn != null && apn.mcc == '302') {
    mobicontrol.log.info("Preferred APN is Canadian.");
}

static install(config) → {mobicontrol.apn.Apn}

Install APN configuration.
Parameters:
Name Type Description
config mobicontrol.apn.ApnConfiguration APN configuration
Throws:
Returns:
mobicontrol.apn.Apn - Installed APN
Since:
  • Version 1.4 (API level 5)
Example
var config = mobicontrol.apn.createApnConfiguration('ltemobile.apn', '302', '720');
mobicontrol.apn.install(config);

static listApns() → {Array.<mobicontrol.apn.Apn>}

List installed APNs.

Note: Android phones come pre-installed with a large database of APN configurations for many different carriers around the world. In order to get APNs available for only the current network operator, use mobicontrol.apn.listCurrentOperatorApns.

Throws:
Returns:
Array.<mobicontrol.apn.Apn> - An array of installed APNs.
Since:
  • Version 1.4 (API level 5)
Example
var apn = mobicontrol.apn.listApns().find(apn => apn.apn === 'ltemobile.apn');
if (apn != null) {
    mobicontrol.apn.setPreferred(apn);
    mobicontrol.log.info("Preferred APN is set to ltemobile.apn.");
}

static listCurrentOperatorApns() → {Array.<mobicontrol.apn.Apn>}

List installed APNs filtered by the current operator.
Throws:
Returns:
Array.<mobicontrol.apn.Apn> - An array of installed APNs filtered by the current operator.
Since:
  • Version 1.4 (API level 5)

static setPreferred(apn)

Set installed APN as preferred.
Parameters:
Name Type Description
apn mobicontrol.apn.Apn Installed APN
Throws:
Since:
  • Version 1.4 (API level 5)
Example
var config = mobicontrol.apn.createApnConfiguration('ltemobile.apn', '302', '720');
var apn = mobicontrol.apn.install(config);
mobicontrol.apn.setPreferred(apn);

static uninstall(apn)

Uninstall APN.
Parameters:
Name Type Description
apn mobicontrol.apn.Apn Installed APN
Throws:
Since:
  • Version 1.4 (API level 5)
Example
const ROGERS_MNC = '720';
mobicontrol.apn.listApns().forEach(
    apn => {
        if (apn.mnc == ROGERS_MNC) {
             mobicontrol.apn.uninstall(apn);
        }
    }
);
mobicontrol.log.info("All Rogers APNs are uninstalled.");