Example #1
0
        public static List <AndroidApp> GetAllAndroidApps()
        {
            List <AndroidApp> apps     = new List <AndroidApp>();
            String            packages = RunCommand("adb shell pm list package");

            String [] temstr   = packages.Split("\r\n".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            DataTable NameList = DataProcess.GetNameList("package_list.csv");

            foreach (String pcknm in temstr)
            {
                String pckname = pcknm.Replace("package:", "");
                pckname = pckname.Replace("\r", "");
                DataRow dr = NameList.Rows.Find(pckname);

                String name       = "";
                String suggestion = "";
                if (dr != null)
                {
                    name       = dr.ItemArray[1].ToString();
                    suggestion = dr.ItemArray[2].ToString();
                }
                AndroidApp temapp = new AndroidApp(pckname, name, suggestion);

                apps.Add(temapp);
            }
            return(apps);
        }
Example #2
0
        public static String UninstallApp(AndroidApp app)
        {
            String cmd = "adb shell pm uninstall --user 0 " + app.GetPackageName();
            String ret = RunCommand(cmd);

            return(DateTime.Now.ToLocalTime().ToString() + " " + app.GetPackageName() + " Uninstall: " + ret + "\n");
        }
        public static List <AndroidApp> ToAndroidAppList(DataTable dt)
        {
            List <AndroidApp> apps = new List <AndroidApp>();

            foreach (DataRow dr in dt.Rows)
            {
                AndroidApp app = new AndroidApp(dr[0].ToString(), dr[1].ToString());
                apps.Add(app);
            }
            return(apps);
        }
Example #4
0
 public bool Equals(AndroidApp a)
 {
     return(this.GetPackageName().Equals(a.GetPackageName()));
 }