InstallReceiver
public
class
InstallReceiver
extends MultiLineReceiver
| java.lang.Object | ||
| ↳ | com.android.ddmlib.MultiLineReceiver | |
| ↳ | com.android.ddmlib.InstallReceiver | |
“pm install package.apk”命令行对应的输出接收器。
结合使用 isSuccessfullyCompleted() 和 getErrorMessage() 来确定安装是否成功以及出现了什么错误。
摘要
公共构造函数 | |
|---|---|
InstallReceiver()
|
|
公共方法 | |
|---|---|
void
|
done()
终止进程。 |
String
|
getErrorCode()
|
String
|
getErrorMessage()
返回安装中的错误消息。 |
String
|
getSuccessMessage()
返回安装的成功消息。 |
boolean
|
isCancelled()
|
boolean
|
isSuccessfullyCompleted()
如果安装完全成功,则返回 true。 |
void
|
processNewLines(String[] lines)
当远程进程接收到新行时调用。 |
公共构造函数
InstallReceiver
public InstallReceiver ()
公共方法
getErrorCode
public String getErrorCode ()
| 返回 | |
|---|---|
String |
类似“Failure [ERROR_CODE: description]”的消息中的 ERROR_CODE 部分 |
getErrorMessage
public String getErrorMessage ()
返回安装中的错误消息。如果成功或发生超时,则返回 null。
| 返回 | |
|---|---|
String |
|
getSuccessMessage
public String getSuccessMessage ()
返回安装的成功消息。如果发现失败,则返回 null。
| 返回 | |
|---|---|
String |
|
isCancelled
public boolean isCancelled ()
| 返回 | |
|---|---|
boolean |
|
isSuccessfullyCompleted
public boolean isSuccessfullyCompleted ()
如果安装完全成功,则返回 true。如果 getErrorMessage() 返回 null 且 isSuccessfullyCompleted() 返回 false,则很可能遇到了设备端超时。
| 返回 | |
|---|---|
boolean |
|
processNewLines
public void processNewLines (String[] lines)
当远程进程接收到新行时调用。
可以保证,当向此方法提供行时,这些行是完整的。
| 参数 | |
|---|---|
lines |
String:包含新行的数组。 |