Exemple #1
0
        /// <summary>
        /// Start an given activity in the given package.
        /// Throws an exception when starting fails.
        /// </summary>
        public void StartActivity(IDevice device, string packageName, string activityName, bool debuggable, int timeout, IStartActivityListener listener)
        {
            var component = packageName + "/" + activityName;
            var receiver  = new StartActivityReceiver(listener);

            using (var socket = new AdbRequest(EndPoint))
            {
                try
                {
                    var args = new List <string>();
                    args.Add("start");
                    if (debuggable)
                    {
                        args.Add("-D");
                    }
                    args.Add("-n");
                    args.Add(component);
                    socket.ExecuteShellCommand(receiver, device, timeout, "am", args.ToArray());
                }
                catch (Exception ex)
                {
                    throw new AdbException(string.Format("Failed to start activity because: {0}", ex.Message));
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Start an given activity in the given package.
 /// Throws an exception when starting fails.
 /// </summary>
 public void StartActivity(IDevice device, string packageName, string activityName, bool debuggable, int timeout, IStartActivityListener listener)
 {
     var component = packageName + "/" + activityName;
     var receiver = new StartActivityReceiver(listener);
     using (var socket = new AdbRequest(EndPoint))
     {
         try
         {
             var args = new List<string>();
             args.Add("start");
             if (debuggable) args.Add("-D");
             args.Add("-n");
             args.Add(component);
             socket.ExecuteShellCommand(receiver, device, timeout, "am", args.ToArray());
         }
         catch (Exception ex)
         {
             throw new AdbException(string.Format("Failed to start activity because: {0}", ex.Message));
         }
     }
 }