Class EdsNetworkUtils
- java.lang.Object
-
- com.verizon.mec.edsclientsdkutils.EdsNetworkUtils
-
public class EdsNetworkUtils extends java.lang.Object
Network Utilities to support identifying and targeting SIMs that support Edge Discovery.
-
-
Constructor Summary
Constructors Constructor Description EdsNetworkUtils()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<android.telephony.SubscriptionInfo>
getAllSubscriptionsOnVerizonNetwork(android.content.Context context)
Retrieve SubscriptionInfo for all SIMs using Verizon Network.java.lang.Integer
getVerizonNetworkDataSubscriptionId(android.content.Context context)
Returns the Default Data Subscription ID if it is using the Verizon network, otherwise return null.android.telephony.SubscriptionInfo
getVerizonNetworkDataSubscriptionInfo(android.content.Context context)
Returns the Default Data Subscription if it is using the Verizon network, otherwise return null.boolean
isVerizonNetworkOperator(java.lang.String networkOperatorMccMnc)
Evaluate supplied network operator MCC/MNC string against known Verizon networks valuesvoid
targetSim(android.content.Context context, android.net.NetworkRequest.Builder nrb, int subscriptionId)
Add SIM target and cellular transport to supplied network request builder.boolean
targetVerizonNetworkSim(android.content.Context context, android.net.NetworkRequest.Builder nrb)
Add targeting information to supplied NetworkRequest.Builder for Verizon cellular network backed default data SIM, if detected; - For Android-N and prior, assume single active SIM and evaluate via default TelephonyManager - For Android-O and newer, evaluate Default Data SIM only (never target non-default data SIM)
-
-
-
Method Detail
-
getAllSubscriptionsOnVerizonNetwork
@RequiresApi(api=24) public java.util.List<android.telephony.SubscriptionInfo> getAllSubscriptionsOnVerizonNetwork(@NonNull android.content.Context context) throws java.lang.SecurityException
Retrieve SubscriptionInfo for all SIMs using Verizon Network. For applications who need to be DSDS (Dual-SIM Dual-Standby) aware and possibly target non-default data SIM. Note: The SIM operator may be non-verizon for SIMs roaming on the Verizon network or for MVNOs. Note: targeting non-default data SIM may require elevated privileges such as MODIFY_PHONE_STATE permission or CarrierPrivileges. Requires READ_PHONE_STATE or equivalent permission- Parameters:
context
- context- Returns:
- List of active SIMs using Verizon as network operator. Maybe empty. Never null.
- Throws:
java.lang.SecurityException
- if application has not been granted READ_PHONE_STATE or equivalent permission
-
getVerizonNetworkDataSubscriptionInfo
@RequiresApi(api=24) public android.telephony.SubscriptionInfo getVerizonNetworkDataSubscriptionInfo(@NonNull android.content.Context context)
Returns the Default Data Subscription if it is using the Verizon network, otherwise return null. Useful for applications who wish only to use default data connection but need additional information about target SIM, available in resulting SubscriptionInfo object. Note: The SIM operator may be non-verizon for SIMs roaming on the Verizon network or MVNOs. Requires READ_PHONE_STATE or equivalent permission.- Parameters:
context
- context- Returns:
- verizon-network backed default data subscription or null;
- Throws:
java.lang.SecurityException
- if called without sufficient permissions
-
getVerizonNetworkDataSubscriptionId
@RequiresApi(api=24) public java.lang.Integer getVerizonNetworkDataSubscriptionId(@NonNull android.content.Context context)
Returns the Default Data Subscription ID if it is using the Verizon network, otherwise return null. Note: The SIM operator may be non-verizon for SIMs roaming on the Verizon network or MVNOs. Requires no runtime permissions.- Parameters:
context
- context- Returns:
- SubscriptionId of verizon-network backed default data subscription or null
-
isVerizonNetworkOperator
public boolean isVerizonNetworkOperator(java.lang.String networkOperatorMccMnc)
Evaluate supplied network operator MCC/MNC string against known Verizon networks values- Parameters:
networkOperatorMccMnc
- network operator MCC/MNC, e.g. "311480"- Returns:
- true if MCC/MNC is known verizon network value, otherwise false.
-
targetVerizonNetworkSim
public boolean targetVerizonNetworkSim(@NonNull android.content.Context context, @NonNull android.net.NetworkRequest.Builder nrb)
Add targeting information to supplied NetworkRequest.Builder for Verizon cellular network backed default data SIM, if detected; - For Android-N and prior, assume single active SIM and evaluate via default TelephonyManager - For Android-O and newer, evaluate Default Data SIM only (never target non-default data SIM)- Parameters:
context
- contextnrb
- network request builder- Returns:
- true if VZW SIM default data SIM was detected and targeting information added, otherwise false.
-
targetSim
@RequiresApi(api=26) public void targetSim(@NonNull android.content.Context context, @NonNull android.net.NetworkRequest.Builder nrb, int subscriptionId)
Add SIM target and cellular transport to supplied network request builder. Useful for applications who wish to target non-default data SIMs or have special user-case where Verizon Default Data SIM targetingtargetVerizonNetworkSim(Context, NetworkRequest.Builder)
is not sufficient. NOTE: most callers will need to add capability INTERNET to builder.- Parameters:
context
- contextnrb
- network request builder.subscriptionId
- target subscription ID.
-
-