locked
Incorporate and call getPackageManager() RRS feed

  • Question

  • User-1753299103 posted

    What is the step by step process of using the following code into a cshtml page

    isAppInstalled("com.simexusa.campusmaps_full");
    
    private boolean isAppInstalled(String packageName) {
        PackageManager pm = getPackageManager();
        boolean installed = false;
        try {
           pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
           installed = true;
        } catch (PackageManager.NameNotFoundException e) {
           installed = false;
        }
        return installed;
    }

    Saturday, January 2, 2016 11:22 PM

Answers

  • User-821857111 posted

    If this is for Android development, you won't be able to run it from a Razor web page. The code itself (if it will even compile) executes on the web server, not the mobile device.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 4, 2016 8:19 AM
  • User-821857111 posted

    No.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 4, 2016 8:23 PM

All replies

  • User-821857111 posted

    If this is for Android development, you won't be able to run it from a Razor web page. The code itself (if it will even compile) executes on the web server, not the mobile device.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 4, 2016 8:19 AM
  • User-1753299103 posted

    Is there way to check from our razor webpages if our app has already been installed on a users mobile device or not?

    Thanks

    Monday, January 4, 2016 7:26 PM
  • User-821857111 posted

    No.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, January 4, 2016 8:23 PM