pwlin / cordova-plugin-file-opener2

A File Opener Plugin for Cordova
MIT License
314 stars 583 forks source link

uninstall function not working #301

Closed keshavkhatri closed 4 years ago

keshavkhatri commented 4 years ago

Expected Behaviour

Should ask to uninstall an app popup

Actual Behaviour

Nothing happens no popup for uninstall

Reproduce Scenario (including but not limited to)

Install this plugin in fresh ionic 5 project and call uninstall function with package id

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

android version 10

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

HMD global nokia 6.1 plus

Cordova CLI info

cordova info

Here is the output: cordova-lib@9.0.1 with: cordova-common@3.2.1 cordova-create@2.0.0 cordova-fetch@2.0.1 cordova-serve@3.0.0

Environment: OS: win32 Node: v12.16.3 npm: 6.14.4

Plugins: cordova-plugin-appavailability cordova-plugin-device cordova-plugin-file-opener2 cordova-plugin-ionic-keyboard cordova-plugin-ionic-webview cordova-plugin-splashscreen cordova-plugin-statusbar cordova-plugin-whitelist

Plugin version

cordova plugin version | grep cordova-plugin-file-opener2

Here is the output: 3.0.2

Sample Code that illustrates the problem

this.fileOpener.uninstall("com.whatsapp").then( (success) => console.log(success, 'app uninstalled'), (error) => console.log(error, 'app not uninstalled') )

Logs taken while reproducing problem

pwlin commented 4 years ago

@keshavkhatri is there any log message? Try to run adb logcat PluginManager:V CordovaPlugin:V CordovaLog:V chromium:V *:S while you are running your uninstall function and see what errors are you getting.

keshavkhatri commented 4 years ago

@pwlin after doing some research on stackoverflow i found that we need to put permission access in AndroidManifest.xml to uninstall packages. But there was no error given from plugin for the same it was still returning success when the uninstall was not working you should fix this.

<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />

adding this in AndroidManifest.xml solved this issue for me.

thanks

pwlin commented 4 years ago

Thank you I have added a note in README.md about using the proper permission.