public class Subscriber
extends java.lang.Object
This class exposes slot number where the subscriber resides as a subscriber identifier. It could be either physical slot or virtual slot. Slot numbers should be user recognizable and slot number 1 must always denote primary subscriber on the device. Slot numbers must be greater than or equal to 1 and are typically a single digit. The highest slot number is implementation and device specific.
The source of Subscriber information can be added or removed.
The Subscriber instances are snapshots of information from the SIM, R-UIM, CSIM
and are immutable. If a Subscriber instance reflects a SIM present in
the device, the getSlotNumber()
will reflect
the location of the SIM, otherwise the slot number will be -1.
The information in the Subscriber and related Properties is the last known
snapshot of information from the physical SIM but the SIM is no longer present.
A SubscriberListener
can be added
or
removed
to monitor changes to the SIM Slot information.
Typically, to be aware of current information about Subscribers,
an application will not retain references to Subscriber instances
but will use the SubscriberListener
or #getSubscribers
mechanisms.
Properties available via getProperties()
:
Property | Description | Value | Network type |
---|---|---|---|
uuid | UUID (Universally Unique Identifier) number of the Subscriber | UUID number | 3GPP, CDMA |
imsi | IMSI (International Mobile Subscriber Identity) number of the Subscriber | IMSI number | 3GPP, CDMA |
iccid | ICCID (Integrated Circuit Card ID) number of the Subscriber | ICCID number | 3GPP, CDMA |
euimid | EUIMID (Expanded User Identity Module Identifier) number of the Subscriber | EUIMID number | CDMA |
mcc | MCC (Mobile Country Code) number of the Subscriber | MCC number | 3GPP, CDMA |
mnc | MNC (Mobile Network Code) number of the Subscriber | MNC number | 3GPP, CDMA |
sid | SID (System Identifier) number of the Subscriber | SID number | CDMA |
nid | NID (Network Identifier) number of the Subscriber | NID number | CDMA |
Modifier and Type | Method and Description |
---|---|
static void |
addListener(SubscriberListener listener)
Adds listener to receive subscribers related events.
|
static Subscriber |
getByPhoneNumber(java.lang.String phoneNumber)
Returns the Subscriber for the phone number.
|
static Subscriber |
getBySlotNumber(int slotNumber)
Returns subscriber by the slot number it occupies.
|
CellularNetwork |
getNetwork()
Returns a cellular network the device is registered into
using this Subscriber.
|
int |
getNetworkType()
Returns the network type of this Subscriber.
|
java.lang.String |
getOperator()
Returns the operator name.
|
java.lang.String |
getPhoneNumber()
Returns the phone number of the subscriber.
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Returns a map containing Subscriber properties.
|
int |
getSlotNumber()
Returns the number of the slot for this Subscriber.
|
static Subscriber[] |
getSubscribers()
Returns an array containing all available subscribers.
|
static void |
removeListener(SubscriberListener listener)
Removes previously added listener.
|
public static Subscriber[] getSubscribers()
public static Subscriber getByPhoneNumber(java.lang.String phoneNumber)
getPhoneNumber()
.phoneNumber
- subscriber phone number, not nulljava.lang.SecurityException
- if the Security policy does not permit
CellularPermission with name "subscriber"public static Subscriber getBySlotNumber(int slotNumber)
Slot number 1 always denotes primary Subscriber. Slot numbers are greater than or equal to 1 and are typically s single digit. Slot numbers are device and implementation specific.
slotNumber
- slot number to get subscriber forjava.lang.IllegalArgumentException
- if the slot number is less than 1
or greater than supported by the device.public static void addListener(SubscriberListener listener)
As soon as a listener is added it will be notified about all subscribers available on the device at this moment, i.e. notifySubscriberEvent with SUBSCRIBER_ADDED event will be called for each available subscriber. This prevents race condition that could exist between registering listener and adding new subscriber.
Does nothing if the listener is already registered as a subscriber listener.
listener
- the listener to addjava.lang.NullPointerException
- if the listener is nullpublic static void removeListener(SubscriberListener listener)
Does nothing if the listener is not registered as a subscriber listener.
listener
- the listener to removejava.lang.NullPointerException
- if the listener is nullpublic int getSlotNumber()
public java.lang.String getPhoneNumber()
The returned number follows the numbering plan defined in the ITU-T recommendation E.164.
java.lang.SecurityException
- if the Security policy does not permit
CellularPermission with name "subscriber"public java.lang.String getOperator()
If no other value is available for the operator name, the concatenation
of the MCC
and MNC
components of the IMSI,
as strings separated by " " (0x20), should be returned.
java.lang.SecurityException
- if the Security policy does not permit
CellularPermission with name "subscriber"public int getNetworkType()
getProperties()
.
This information is always valid for the Subscriber and does not change.CellularNetwork.NETWORK_3GPP
,
CellularNetwork.NETWORK_CDMA
public java.util.Map<java.lang.String,java.lang.String> getProperties()
getNetworkType()
is listed for the key.
The value null
is returned from Map.get(key)
if the key is not defined for the network type.
This information is always valid for the Subscriber and does not change.java.lang.SecurityException
- if the Security policy does not permit
CellularPermission with name "subscriber"public CellularNetwork getNetwork()
getNetwork
returns null.
The value of getNetwork()
may change
based on the current connection or lack of connection to the network.
null
if the Subscriber is not currently
registered with any network.Copyright (c) 2013, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.