示例#1
0
        /// <summary>
        /// Gets the apk path.
        /// </summary>
        /// <param name="package">The package.</param>
        /// <returns></returns>
        public string GetApkPath(string package)
        {
            if (this.Device.IsOffline)
            {
                throw new IOException("Device is offline");
            }

            PackageManagerPathReceiver receiver = new PackageManagerPathReceiver();

            this.Device.ExecuteShellCommand("pm path {0}", receiver, package);
            if (!string.IsNullOrEmpty(receiver.Path))
            {
                return(receiver.Path);
            }
            else
            {
                throw new FileNotFoundException(string.Format("The package '{0}' is not installed on the device: {1}", package, Device.SerialNumber));
            }
        }
示例#2
0
        /// <summary>
        /// Gets the apk path.
        /// </summary>
        /// <param name="package">The package.</param>
        /// <returns></returns>
        public String GetApkPath( String package )
        {
            if ( this.Device.IsOffline ) {
                throw new IOException ( "Device is offline" );
            }

            PackageManagerPathReceiver receiver = new PackageManagerPathReceiver();
            this.Device.ExecuteShellCommand ( "pm path {0}", receiver, package );
            if ( !String.IsNullOrEmpty ( receiver.Path ) ) {
                return receiver.Path;
            } else {
                throw new FileNotFoundException ( String.Format ( "The package '{0}' is not installed on the device: {1}", package, Device.SerialNumber ) );
            }
        }