How to Set the Preferred Network Type for Cellular Networks Using API: Difference between revisions

From wizarPOS
No edit summary
Line 1: Line 1:
The system provides the AIDL interface to set the preferred network type, When connect the service, the package name is '''com.wizarpos.wizarviewagentassistant''', and the class name is '''com.wizarpos.wizarviewagentassistant.SystemExtApiService'''. When the application uses the interface, it must import wizarviewagentassistant and add permissions to the Android manifest file.
The system provides the AIDL interface to set the preferred network type, When connect the service, the package name is '''com.wizarpos.wizarviewagentassistant''', and the class name is '''com.wizarpos.wizarviewagentassistant.SystemExtApiService'''. When the application uses the interface, it must import wizarviewagentassistant and add permissions to the Android manifest file.
 
===== Important Reminder: Insert SIM Card First =====
  Please note that:
 
  * Insert SIM card first
 
== Permission ==
== Permission ==
The application declares the following permissions in the manifest:
The application declares the following permissions in the manifest:
Line 21: Line 17:
|-
|-
| networkType  || '''int:'''  The preferred network type, defined in RILConstants.java.
| networkType  || '''int:'''  The preferred network type, defined in RILConstants.java.
|}
{|
|-
|}
{|class="wizarpostable"
|-
|-
!  scope="row" colspan="2" | Returns
!  scope="row" colspan="2" | Returns
Line 36: Line 26:
=== <big>getPreferredNetworkType</big>===
=== <big>getPreferredNetworkType</big>===
   <syntaxhighlight lang="java">int getPreferredNetworkType(int phoneId);</syntaxhighlight>
   <syntaxhighlight lang="java">int getPreferredNetworkType(int phoneId);</syntaxhighlight>
Get the preferred network type. Used for device configuration by some CDMA operators.
Get the preferred network type. Used for device configuration by some CDMA operators.


{|class="wizarpostable"
{|class="wizarpostable"
Line 43: Line 33:
|-
|-
| phoneId ||  '''int:''' The ID of the subscription to set the preferred network type for.
| phoneId ||  '''int:''' The ID of the subscription to set the preferred network type for.
|}
{|
|-
|}
{|class="wizarpostable"
|-
|-
!  scope="row" colspan="2" | Returns
!  scope="row" colspan="2" | Returns
Line 58: Line 42:
=== <big>getSupportedNetworkTypes</big>===
=== <big>getSupportedNetworkTypes</big>===
   <syntaxhighlight lang="java">NetworkType[] getSupportedNetworkTypes();</syntaxhighlight>
   <syntaxhighlight lang="java">NetworkType[] getSupportedNetworkTypes();</syntaxhighlight>
Get supported network type array. NetworkType: name, typeId;
Get supported network type array. NetworkType: name, typeId;


{|class="wizarpostable"
{|class="wizarpostable"

Revision as of 20:29, 5 January 2024

The system provides the AIDL interface to set the preferred network type, When connect the service, the package name is com.wizarpos.wizarviewagentassistant, and the class name is com.wizarpos.wizarviewagentassistant.SystemExtApiService. When the application uses the interface, it must import wizarviewagentassistant and add permissions to the Android manifest file.

Important Reminder: Insert SIM Card First

Permission

The application declares the following permissions in the manifest:

 com.wizarpos.permission.MODIFY_PHONE_STATE

API Overview

setPreferredNetworkType

boolean setPreferredNetworkType(int phoneId, int networkType);

Set the preferred network type. Used for device configuration by some CDMA operators.

Parameters
phoneId int: The ID of the subscription to set the preferred network type for.
networkType int: The preferred network type, defined in RILConstants.java.
Returns
boolean true is success, false is failure.


getPreferredNetworkType

int getPreferredNetworkType(int phoneId);

Get the preferred network type. Used for device configuration by some CDMA operators.

Parameters
phoneId int: The ID of the subscription to set the preferred network type for.
Returns
int The preferred network type, defined in RILConstants.java.


getSupportedNetworkTypes

NetworkType[] getSupportedNetworkTypes();

Get supported network type array. NetworkType: name, typeId;

Returns
NetworkType[] The supported network type array.

Download

Demo

Please download the demo