コード例 #1
0
 /// <summary>
 /// 启动一个组件,例如某个activity
 /// </summary>
 /// <param name="componentName"></param>
 /// <param name="intent"></param>
 /// <exception cref="Exceptions.AdbShellCommandFailedException"></exception>
 public void StartComponent(ComponentName componentName, Intent intent = null)
 {
     CmdStation.GetShellCommand(Device,
                                $"am start -n {componentName.ToString()} {intent?.ToAdbArguments()}")
     .To(RaiseOutput)
     .Execute()
     .ThrowIfShellExitCodeNotEqualsZero();
 }
コード例 #2
0
 /// <summary>
 /// 设置Device Owner
 /// </summary>
 /// <param name="cn">组件名</param>
 /// <param name="uid">UID,不填则将对全部用户起效</param>
 /// <param name="name">易读的别名(the human-readable organization name)</param>
 /// <exception cref="Exceptions.AdbShellCommandFailedException"></exception>
 public void SetDeviceOwner(ComponentName cn, int?uid = null, string name = null)
 {
     SetDeviceOwner(cn.ToString(), uid, name);
 }
コード例 #3
0
 private static string ToIntentValue(this ComponentName cn)
 {
     return(cn.ToString());
 }
コード例 #4
0
 /// <summary>
 /// 设置ActiveAdmin
 /// </summary>
 /// <param name="cn">组件名</param>
 /// <param name="uid">UID,不填则将对全部用户起效</param>
 /// <exception cref="Exceptions.AdbShellCommandFailedException"></exception>
 public void SetActiveAdmin(ComponentName cn, int?uid = null)
 {
     SetActiveAdmin(cn.ToString(), uid);
 }
コード例 #5
0
 /// <summary>
 /// 启动服务
 /// </summary>
 /// <param name="cn"></param>
 /// <param name="intent"></param>
 public void Start(ComponentName cn, Intent intent = null)
 {
     Executor.AdbShell(Device,
                       $"am startservice -n {cn.ToString()} {intent?.ToString()}")
     .ThrowIfShellExitCodeNotEqualsZero();
 }