Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
fix(app): validate installation status
Browse files Browse the repository at this point in the history
Signed-off-by: Rafa Hernandez <[email protected]>
  • Loading branch information
rafaelje authored and Hector Rondon committed Feb 19, 2018
1 parent 589438c commit 3667c51
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions app/src/main/java/org/flyve/mdm/agent/ui/InstallAppActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,29 +137,33 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
status = "2"; // installed
} else {
FlyveLog.d("Installation failed");
finish();
}
}

PackageManager packageManager = InstallAppActivity.this.getPackageManager();

PackageInfo packageInfo = packageManager.getPackageArchiveInfo(appPath, 0);
packageInfo.applicationInfo.sourceDir = appPath;
packageInfo.applicationInfo.publicSourceDir = appPath;
try {
PackageManager packageManager = InstallAppActivity.this.getPackageManager();

String appName = packageManager.getApplicationLabel(packageInfo.applicationInfo).toString();
String appPackage = packageInfo.packageName;
PackageInfo packageInfo = packageManager.getPackageArchiveInfo(appPath, 0);
packageInfo.applicationInfo.sourceDir = appPath;
packageInfo.applicationInfo.publicSourceDir = appPath;

String appName = packageManager.getApplicationLabel(packageInfo.applicationInfo).toString();
String appPackage = packageInfo.packageName;

AppDataBase dataBase = AppDataBase.getAppDatabase(InstallAppActivity.this);
Application apps = new Application();
AppDataBase dataBase = AppDataBase.getAppDatabase(InstallAppActivity.this);
Application apps = new Application();

apps.appId = id;
apps.appName = appName;
apps.appPath = appPath;
apps.appStatus = status; // 1 pending | 2 installed
apps.appPackage = appPackage;
apps.appId = id;
apps.appName = appName;
apps.appPath = appPath;
apps.appStatus = status; // 1 pending | 2 installed
apps.appPackage = appPackage;

dataBase.applicationDao().insert(apps);
dataBase.applicationDao().insert(apps);
} catch (Exception ex) {
FlyveLog.e(ex.getMessage());
}

finish();
}
Expand Down

0 comments on commit 3667c51

Please sign in to comment.