You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try many time for PackageManager.Exist("mypackage"). Exit method crash.
because it use PackageManager.GetApkFileEntry. but GetApkPath more stable and find my apk's path.
I think. PackageManager.Exist method edit like as following
The package is not the path to your apk, it is your package name. From that value, the system calls pm path <package_name> and gets where the package lives on the device.
Please explain the scenario that it fails so I can attempt to reproduce it.
string package_path = "";
try
{
package_path = tmpdevice.PackageManager.GetApkPath("com.LedFire.Cathay");
}
catch (Exception apk_not_found_exception) { }
if (package_path == "")
{
Console.WriteLine("LedFire not loaded on this machine: " + tmpdevice.SerialNumber); continue;
}
and works good.
after this code package_path set to "/data/app/com.LedFire.Cathay-25.apk"
but i try like this Exist() method always returned false.
Boolean LedFire_exist = tmpdevice.PackageManager.Exists("com.LedFire.Cathay");
if (!LedFire_exist) Console.WriteLine("LedFire not loaded on this machine: " + tmpdevice.SerialNumber); continue;
and not working.
my package name is "com.LedFire.Cathay" . but i think ,because of "-25 ".
LedFire is my app and under development and reinstall offen.
I try many time for PackageManager.Exist("mypackage"). Exit method crash.
because it use PackageManager.GetApkFileEntry. but GetApkPath more stable and find my apk's path.
I think. PackageManager.Exist method edit like as following
public bool Exists ( String package ) {
try {
return GetApkPath ( package ) != null;
} catch ( FileNotFoundException) {
return false;
}
}
The text was updated successfully, but these errors were encountered: