java.lang.Object android.device.DeviceManager
public class DeviceManager
The DeviceManager class provides support to get and set the device configurations.
Use this class to control the basic functions of the equipment system, according to the following steps,
import android.device.DeviceManager;
DeviceManager manager = new DeviceManager();
String sn = manager.getTIDSN();
For more information about the device configurations, read DeviceManager sample.
Constructor Summary | |
---|---|
DeviceManager()
The DeviceManager class provides support to get and set the device configurations. |
Method Summary | |
---|---|
java.lang.String |
getDeviceId()
Get the device SN. |
java.lang.String |
getTIDSN()
Get the TUSN number of the device. |
boolean |
setCurrentTime(long when)
Set the current wall time, in milliseconds. |
void |
enableHomeKey(boolean enable)
Enable/Disable device Home key. |
void |
enableStatusBar(boolean enable)
Enable/Disable the device status bar. |
boolean |
setAPN(java.lang.String name,
java.lang.String apn,
java.lang.String proxy,
int port,
java.lang.String user,
java.lang.String server,
java.lang.String password,
java.lang.String mmsc,
java.lang.String mcc,
java.lang.String mnc,
java.lang.String mmsproxy,
int mmsport,
int authType,
java.lang.String type,
java.lang.String protocol,
int bearer,
java.lang.String roamingProtocol,
boolean current)
Set the access point name(APN) configurations for mobile data network. |
boolean |
installApplication(java.lang.String apkFilePath)
Install a android package. |
boolean |
uninstallApplication(java.lang.String packageName)
Attempt to remove an android package. |
boolean |
getDockerState()
Only supports i9000S(Android 4.3/Android5.1). The function is to test the docking station connection status of the current device. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
public DeviceManager()
public java.lang.String getDeviceId()
public java.lang.String getTIDSN()
public boolean setCurrentTime(long when)
when
- in milliseconds. The expression of time is the number of milliseconds between the current time and GMT (Greenwich mean time) at 0:00:00 on January 1, 1970.
DeviceManager deviceManager = new DeviceManager();
deviceManager.setCurrentTime(1562226000);
public void enableHomeKey(boolean enable)
enable
- Set to false to disable the Home key function and set to true to enable the Home key function.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new DeviceManager().enableHomeKey(false);
}
protected void onDestroy() {
new DeviceManager().enableHomeKey(true);
}
public void enableStatusBar(boolean enable)
enable
- Set to true to enable the status bar. Set to false to disable the status bar expand.
DeviceManager deviceManager = new DeviceManager();
deviceManager.enableStatusBar(false);
public boolean setAPN(java.lang.String name, java.lang.String apn, java.lang.String proxy, int port, java.lang.String user, java.lang.String server, java.lang.String password, java.lang.String mmsc, java.lang.String mcc, java.lang.String mnc, java.lang.String mmsproxy, int mmsport, int authType, java.lang.String type, java.lang.String protocol, int bearer, java.lang.String roamingProtocol, boolean current)
name
- Entry name. Cannot be null.
apn
- APN name. Cannot be null.
proxy
- Proxy address.
port
- Proxy port.
user
- APN username.
server
- Server address.
password
- APN password.
mmsc
- MMSC URL.
mcc
- Mobile Country Code (MCC).
mnc
- MNC Mobile Network Code (MNC). Cannot be null.
mmsproxy
- MMS proxy address.
mmsport
- MMS proxy port.
authType
- Authentication type. Value:
type
- Comma-delimited list of APN types.
protocol
- The protocol to use to connect to this APN. Value: IPv6 or IPv4.
bearer
- BEARER Radio Access Technology info. Value:
roamingProtocol
- The protocol to use to connect to this APN when roaming.
current
- Enable current APN.
public boolean installApplication(java.lang.String apkFilePath)
apkFilePath
- The location of the package file to install. This can
be a 'file:' or a 'content:' URI.
DeviceManager deviceManager = new DeviceManager();
boolean ret = deviceManager.installApplication("/sdcard/test.apk");
if(ret)
//install success
else
//install failed
public boolean uninstallApplication(java.lang.String packageName)
packageName
- The name of the package to delete.
DeviceManager deviceManager = new DeviceManager();
boolean ret = deviceManager.uninstallApplication("com.device.uhome");
if(ret)
//uninstall success
else
//uninstall failed
public boolean getDockerState()