EddyVerbruggen / EddyVerbruggen/nativescript-appavailability

Breaking on Nativescript 6.5 with Android (Angular)

Open
#7 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
19
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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;
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.