Package com.unitech.api.telephony
Class TelephonyCtrl
java.lang.Object
com.unitech.api.telephony.TelephonyCtrl
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionandroid.os.BundleDeletes an eSIM subscription by name of ICCID or Display Name.android.os.BundledownloadESimSubscription(String activateCode, boolean switchAfterDownload) Downloads an eSIM subscription.android.os.BundledownloadESimSubscriptionWithNickName(String activateCode, String nickName, boolean switchAfterDownload) Downloads an eSIM subscription and change nickname.android.os.BundlegetEID()Retrieves the eSIM ID.android.os.BundleRetrieves the network data usage for the last 24 hours.android.os.BundleRetrieves the Subscription information.android.os.BundleChecks if a SIM card exists.android.os.BundleswitchESimByName(String name) Switches to the eSIM with the specified display name or ICCID.
-
Field Details
-
BUNDLE_ERROR_CODE
- See Also:
-
BUNDLE_ERROR_MSG
- See Also:
-
RESULT_CODE_ERROR
public static final int RESULT_CODE_ERROR- See Also:
-
RESULT_CODE_SUCCESS
public static final int RESULT_CODE_SUCCESS- See Also:
-
-
Constructor Details
-
TelephonyCtrl
public TelephonyCtrl(android.content.Context context)
-
-
Method Details
-
isSimCardExist
public android.os.Bundle isSimCardExist()Checks if a SIM card exists.- Returns:
- A
Bundlecontaining the following:int errorCode- The error code (1 for error, 0 for success)String errorMsg- The error message, if anyboolean isSimCardExist- Whether a SIM card exists (default isfalseif not present)
int errorCode = bundle.getInt("errorCode"); String errorMsg = bundle.getString("errorMsg"); boolean isSimCardExist = bundle.getBoolean("isSimCardExist", false);
-
getNetworkDataUsage
public android.os.Bundle getNetworkDataUsage()Retrieves the network data usage for the last 24 hours.- Returns:
- A
Bundlecontaining the following:int errorCode- error code (1 for error, 0 for success)String errorMsg- error messageArrayList<NetworkDataUsage> networkDataUsages- network data usage list, obtained viaNetworkDataUsage.convertToUsageList(bundle.getStringArrayList("getNetworkDataUsage"))
"0"- No data exists"0 B"- Zero bytes transferred for specific Rx or Tx"X B"- X bytes transferred for specific Rx or Tx (whereBrepresents bytes)
- B - Bytes
- K - Kilobytes (KB)
- M - Megabytes (MB)
- G - Gigabytes (GB)
- T - Terabytes (TB)
- P - Petabytes (PB)
- E - Exabytes (EB)
Bundle bundle = getNetworkDataUsage(); // Retrieve the error code and message int errorCode = bundle.getInt("errorCode"); String errorMsg = bundle.getString("errorMsg"); // Handle error if (errorCode == 1) { Log.d("NetworkDataUsage", "Error: " + errorMsg); } else { // Convert the network data usage list ArrayList<NetworkDataUsage> networkDataUsages = NetworkDataUsage.convertToUsageList(bundle.getStringArrayList("getNetworkDataUsage")); // Process each usage data for (NetworkDataUsage usage : networkDataUsages) { Log.d("NetworkDataUsage", "Mobile Rx: " + usage.getMobileRx()); Log.d("NetworkDataUsage", "Mobile Tx: " + usage.getMobileTx()); Log.d("NetworkDataUsage", "WiFi Rx: " + usage.getWifiRx()); Log.d("NetworkDataUsage", "WiFi Tx: " + usage.getWifiTx()); } }
-
downloadESimSubscription
Downloads an eSIM subscription.- Parameters:
activateCode- The activation codeswitchAfterDownload- Whether to switch to the downloaded eSIM subscription after download- Returns:
- A bundle containing the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
downloadESimSubscriptionWithNickName
public android.os.Bundle downloadESimSubscriptionWithNickName(String activateCode, String nickName, boolean switchAfterDownload) Downloads an eSIM subscription and change nickname.- Parameters:
activateCode- The activation codenickName- The nickname of the eSIM subscriptionswitchAfterDownload- Whether to switch to the downloaded eSIM subscription after download- Returns:
- A bundle containing the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
*
-
deleteESimSubscriptionByName
Deletes an eSIM subscription by name of ICCID or Display Name.- Parameters:
name- The display name of the eSIM to switch to- Returns:
- A bundle containing the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
switchESimByName
Switches to the eSIM with the specified display name or ICCID.- Parameters:
name- The display name of the eSIM to switch to- Returns:
- A bundle containing the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
getEID
public android.os.Bundle getEID()Retrieves the eSIM ID.- Returns:
- A bundle containing the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
String EID = bundle.getString("EID");
-
getSubscriptionInfo
public android.os.Bundle getSubscriptionInfo()Retrieves the Subscription information.- Returns:
- A bundle containing the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
using keySet() to retrieve what keys are included in this bundle
-