Skip to content

Breaking on Nativescript 6.5 with Android (Angular) #7

@flodaniel

Description

@flodaniel

plugin lines 5 and 25 :

var pm = com.tns.NativeScriptApplication.getInstance().getPackageManager();
are failing with

TypeError: Cannot read property 'getPackageManager' of null

I worked around it by only using the plugin for ios und using adapting the code for android to the following:

try {
    const pm: android.content.pm.PackageManager = (app.android.context as android.content.Context).getPackageManager();
    pm.getPackageInfo(appName, 0); // will fail, if appName is not installed as package
    isAppAvailable = true;
} catch (error) {
    isAppAvailable = false;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions