Closed mortenpj closed 5 years ago
This module contains the code fix that was added by the commit to fix phonegap-launch-navigator#182. Therefore the behaviour should be the same for both the Phonegap plugin and this React Native module.
It's possible that on newer Android versions this fix no longer works - I'll need to test this to confirm.
I tested disabling of Google Maps using the example project on a Pixel 2 XL running Android Q. After disabling Google Maps and restarting the app, this module correctly detected Google Maps as unavailable
2019-07-02 08:36:24.377 11110-11138/com.rnlnexample D/LaunchNavigator[native]: google_maps is not available
Please build and run the example project on your device with Google Maps disabled - make sure to disable Google Maps before launching the example app.
I have verified that the code used in our application does not return the expected value. I see when I clone the git repo of the launcher example google maps is indeed not showing in the list. However this example project doesnt use the specific method which returns the incorrect value when google maps is disabled.
The specific method I'm using and which returns true even when google maps is disabled is the foloowing: LaunchNavigator.isAppAvailable(LaunchNavigator.APP.GOOGLE_MAPS)
I could also with some minor changes in the example project, reproduce it. (There might be a easier way but this is the way I could make the code run atleast)
In LNAppPicker.js change the method
async getAvailableApps(): Promise
async getAvailableApps(): Promise
This will make it so it only shows one option in the selection list, but when google maps is disabled I expect this code to now show me the option "Google maps is disabled". However it shows the option "Google maps is available"
This is reproduced on a Samsung S7 edge running Android version 8.0.0 (Physical device)
OK, thanks for being explicit - I hadn't realised the example project doesn't actually use that method - it probably should so it can validate it going forward. Definitely sounds like a bug then. Will fix and push out in a patch release shortly.
That sounds great. Thanks for very fast responses
Finally had time to look into this.
The problem is a documentation issue rather than a bug in functionality.
The actual method documentation is correct - it shows that isAppAvailable()
returns a Promise (not a boolean).
However the Advanced usage example is wrong and implies it returns a boolean.
Correct usage is:
LaunchNavigator.isAppAvailable(app).then((isAvailable) => console.log(app+" is available: " + isAvailable));
If you follow this usage, upon disabling Google Maps, the promise callback value for isAvailable
will be false
.
I'll fix the example mentioned above to resolve this issue.
Ah, I understand, I was specifically looking to detect if the app was available so I must have looked at the advanced usage documentation. I'll change it to use promise, and I assume I'll get the expected result.
Thank you
I'm submitting a ... (check one with "x"):
Bug report
Current behavior:
LaunchNavigator.isAppAvailable(LaunchNavigator.APP.GOOGLE_MAPS) returns true even when google maps have been disabled
Expected behavior:
LaunchNavigator.isAppAvailable(LaunchNavigator.APP.GOOGLE_MAPS) should return false when app is not available for using or launching
Steps to reproduce: Use android phone where Google maps can not be uninstalled. Press and hold over google maps icon until menu appears, choose disable app. Method LaunchNavigator.isAppAvailable(LaunchNavigator.APP.GOOGLE_MAPS) returns true
Environment information Not relevant for this bug
Have verified the bug with this phone, but would imagine its a problem for all phones where google maps can only be disabled and not uninstalled
Runtime issue
Other information: Same bug was fixed for phonegap https://github.com/dpa99c/phonegap-launch-navigator/issues/182