ionic-team / ionic-native-google-maps

Google maps plugin for Ionic Native
Other
221 stars 125 forks source link

LocationService.hasPermission() Class Not Found. #99

Closed jscarl closed 5 years ago

jscarl commented 5 years ago

I'm submitting a ... (check one with "x")

If you choose 'problem or bug report', please select OS: (check one with "x")

cordova information: (run $> cordova plugin list)

cordova-plugin-device 2.0.2 "Device"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.4.6 "cordova-plugin-googlemaps"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 2.2.0 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"

If you use @ionic-native/google-maps, please tell the package.json (only @ionic-native/core and @ionic-native/google-maps are fine mostly)

Current behavior:

Expected behavior:

Screen capture or video record: image

Related code, data or error log (please format your code or data):

The person who share your project files on Github (or other git repository) is in faster lane than other people.
Please share your project files on Github or others(Bitbucket, Gitlabs...etc).
If you don't want to share your project files, please create a demo project, then share it.

Screen captures, and/or native logs(such as Logcat, xcode logs) are appreciate.

Giving much information, you are waiting time is less.
Thank you for your cooperation.
wf9a5m75 commented 5 years ago

deviceready event is not fired before using this plugin.

jscarl commented 5 years ago

i have call LocationService.hasPermission() after platform.ready() but the console show Class Not Found. any solution?

wf9a5m75 commented 5 years ago

Until you solve the message deviceready has not fired after 5 seconds, you can't use the statement

Jbelmonte commented 5 years ago

It looks like this is a cordova-plugin-googlemaps issue. It crashes inside LocationService.js because JS code binds to an unexisting class LocationService in native code (its name is PluginLocationService actually).

Excerpt from hasPermission function, line 21:

reject.bind(self), 'LocationService', 'hasPermission', [], {sync: true});

whilst getMyLocation function binds to the correct one PluginLocationService at line 57:

reject.bind(self), 'PluginLocationService', 'getMyLocation', [params], {sync: true});

I updated line 21 locally and it worked as expected.

wf9a5m75 commented 5 years ago

@Jbelmonte Thank you for figured out.