/// <summary>
        /// Run the process.
        /// </summary>
        protected override void DoWork()
        {
            // Get APK package name
            var apk         = new ApkFile(apkPath);
            var packageName = apk.Manifest.PackageName;

            // Now install
            var adb = new Adb {
                Logger = LogOutput
            };

            adb.InstallApk(device.Serial, apkPath, packageName, Adb.Timeout.InstallApk);
        }
Beispiel #2
0
        /// <summary>
        /// Run the packet on the given (already started) device.
        /// </summary>
        private void RunOnStartedDevice(IDevice device)
        {
            // Set state
            stateUpdate(LauncherStates.Deploying, string.Empty);

            // Prepare debug launcher
            Launcher.PrepareForLaunch();

            // Install package
            if (IsCancelled)
            {
                return;
            }
            var adb = new Adb();

            adb.Logger += LogLine;

            if (DeployApk)
            {
                LogLine(string.Format("----- Installing {0}", apkPath));
                adb.InstallApk(device.Serial, apkPath, packageName, Adb.Timeout.InstallApk);
                LogLine(string.Format("----- Installed {0}", apkPath));
            }

            // Prepare for debugger attachment (if debuggable)
            if (IsCancelled)
            {
                return;
            }
            if (debuggable)
            {
                Launcher.StartLaunchMonitor(ide, device, apkPath, packageName, minSdkVersion, launchFlags, stateUpdate, cancellationTokenSource.Token);
            }

            // Run activity
            if (IsCancelled)
            {
                return;
            }
            stateUpdate(LauncherStates.Starting, string.Empty);
            LogLine(string.Format("----- Starting activity {0}", activity));
            adb.StartActivity(device, packageName, activity, debuggable, Adb.Timeout.StartActivity, this);
            LogLine(string.Format("----- Started activity {0}", activity));
            stateUpdate(LauncherStates.Started, string.Empty);
        }
Beispiel #3
0
 /// <summary>
 /// Execute the install.
 /// </summary>
 public override bool Execute()
 {
     try
     {
         var adb = new Adb();
         adb.Logger += s => {
             if (!string.IsNullOrEmpty(s))
             {
                 Log.LogMessage(MessageImportance.High, s);
             }
         };
         adb.InstallApk(null, Package.ItemSpec, GetApkName, true, Adb.Timeout.InstallApk);
         return(true);
     }
     catch (Exception ex)
     {
         Log.LogErrorFromException(ex);
         return(false);
     }
 }