apache / cordova-plugin-device

Apache Cordova Device Plugin
https://cordova.apache.org/
Apache License 2.0
387 stars 428 forks source link

ondeviceready won't fire because plugin does not cleanup after itself properly when removed(?) #190

Open igorsantos07 opened 7 months ago

igorsantos07 commented 7 months ago

Bug Report

Originally reported at #125

Problem

If an application has this plugin installed and, for some reason, it's not needed anymore and removed, ondeviceready won't fire anymore. This seems to be caused by some leftover code... That's probably why the previous reporter mentioned the usual shenanigans of add/remove platform/plugins solved it.

What is expected to happen?

The event should fire as usual, since it's seemingly unrelated to this plugin.

What does actually happen?

ondeviceready never gets fired: image

Logcat displays the following (easier to find if you filter logcat by the package name):

2023-10-14 22:59:13.783 29167-29267 PluginManager           io.cordova.hellocordova              D  exec() call to unknown plugin: Device
2023-10-14 22:59:13.834 29167-29167 chromium                io.cordova.hellocordova              I  [INFO:CONSOLE(80)] "[ERROR] Error initializing cordova-plugin-device: Class not found", source: https://localhost/plugins/cordova-plugin-device/www/device.js (80)
2023-10-14 22:59:18.645 29167-29167 chromium                io.cordova.hellocordova              I  [INFO:CONSOLE(1237)] "deviceready has not fired after 5 seconds.", source: https://localhost/cordova.js (1237)
2023-10-14 22:59:18.645 29167-29167 chromium                io.cordova.hellocordova              I  [INFO:CONSOLE(1230)] "Channel not fired: onCordovaInfoReady", source: https://localhost/cordova.js (1230)

Command or Code

$ cordova create sample-reproduction
$ cd sample-reproduction
$ cordova platform add android
$ cordova plugin add cordova-plugin-device
$ cordova plugin rm cordova-plugin-device
$ cordova run android

Environment, Platform, Device

Version information

Nothing besides what was described above seems relevant.

Checklist