I have a web app built using react embedded in a native app using WebChrome Client.
The react app tries to read your current geolocation using HTML5 Geo Location API and show results based on that.
It is working fine for most android devices but it is not working for certain Huawei phones in African Market because Google Play Services is missing from those devices.
While there is a way to get the geolocation of the device without Google Play Service by using Android Location Manager.
But the question is how do I configure WebChromeClient to use the Android Location Manager instead of Google Play Services?
I looked at the WebChromeClient interface but found no way to do it.
Any ideas are appreciated.
Huawei Location Kit may help with your issue.
Location Kit provides capabilities for you to obtain the precise user device location quickly, helping you build up global positioning capabilities and expand your global business. Currently, Location Kit offers two modes for accessing its capabilities.
Android : The Location SDK for Android offers location-related APIs for your Android apps. These APIs mainly related to four functions: fused location, activity identification, geofence, and high-precision location. This mode is applicable to mobile phones and Huawei tablets.
REST API : REST APIs of Location Kit enable you to initiate requests using HTTPS to call location-related capabilities, including geofence and GeoLocation (API). This mode is applicable to web clients.
For Details, pls kindly refer Docs.
Huawei also has provided some HMS Core kit plugins for React Native:
Reference documents
Location Kit plugins for React Native
Related
I'm developing an android project.I want to integrate Huawei mobile services for Huawei devices without google play services. in this project I have developed but when I test it for Huawei P40 in cloud debugging environment, Huawei mobile services don't work.It works when i test it on Huawei mate 10 pro.Huawei mobile services location kit not reacting at p40. How can i solve this please help me
Update:
I got the following message in Logcat. Message is; I/Last Location:
Last location is null!
Please check whether getLastLocation obtains location information from the system cache. If it does, the obtained location is null when the system cache has been cleared. In this case, call requestLocationUpdates to cache the current location. Then, you can obtain the location information by calling getLastLocation.
Here is the HMS Core Location Kit demo on github here. Please update to the latest version :)
Please ensure that the location permission has been assigned to the HMS Core app. Go to Settings > Apps > Apps and find the HMS Core app. (The menu path may vary depending on the operating system version. If you cannot find the app, tap the menu icon in the upper right corner of Apps and tap Show system processes.) Then, tap the HMS Core icon, go to App info > Permissions > Location, and verify that the location permission is assigned to HMS Core.
You probably cannot use the high-precision location service as it is currently supported only on HUAWEI P40 series and is available only in the Chinese mainland.
Activity identification and geofence are not supported on emulators.
If the error persists, please provide us with logs of the fault.
You can perform the following operations to capture the logs:
1). Run the following command to connect to the device
adb logcat –v time > D:\hwlocation.log
2). Reproduce the fault.
3).Press Ctrl+C.
In addition, record the device model, EMUI version, HMS Core version, integrated SDK version, and fault reproduction procedure so that technical personnel can help you quickly troubleshoot the fault.
#Fred,
Using Android Management API how can we get the Location information of a device. Do we need to install any 3rd party application to get the location? How Location modes impact Location information?
There is currently no way to do this using Android Management API. You can use a policy to enable the location mode but you will need another 3rd party application to get the location of the device. You can check this post on how to set the location policy.
For the location mode options, you can refer to this link. However, for devices running Android 9 and 10, setting the locationmode to any mode other than OFF or LOCATION_DISABLED will just turn on the location.
The Realwear HMT device mentions that it supports Assisted GPS. The device does not have google play service installed. There are no samples available for GPS on their Github.
How do I access the location on the device?
Accessing the location services on the HMT-1 is done via the Location Manager, which is standard Android functionality. Implementation wise, it is accomplished exactly the same as any other Android device, the only difference comes when optimizing the application for voice control. The correct permissions must be added to the manifest, but Google Play Services is not required for GPS/AGPS to function.
On the HMT, go to My Programs>'Settings'>'Page Down'>'Location'>'Mode', then say 'High Accuracy'>'Agree' to select this mode.
https://developer.android.com/reference/android/location/LocationManager
I want to build an application where the user can see his current location, and all the users logged in to the app as well.
I want to build it for Android and IOS.
Can I use Apple Maps on IOS and Google Maps API on Android?
Will the application be able to show the current logged in users location on both IOS and Android with no problems? even though am using Apple maps on IOS and Google Maps API on Android?
To be more clear: the android user can also see the IOS users on the map and Vice-Versa
Or I have to use Google Maps API on IOS as well?
Its possible. Just you need to save the lat long on your server of every logged in user. And while any client i.e. Android or iOS app login the app you can have an endpoint that returns the location of all logged in users in server. For server component, you need to develop one endpoint to save the lat long and one endpoint to fetch all the lat long's saved on server.
Of course can. iOS and Android native components will return you same location (as much as possible apart) in spherical coordinate system, then you can do with this location what do you want.
Yes you can. The information is sent by the clients, on the server side you can manage/handle that information as you want/need ;)
I'm in a very early stage of developing an android app that needs to make constant updates on the location of the user (near-exactly lat and long) while walking on the street. I'm not exactly sure if there is a class or method in Android that can help me (GPS?), or if I have to user something external, like Google Maps API (like geocoder).
So that's the question, Android can update my location or should i need the help of Google?
EDIT: I won't use this data to display it on a Google Map interface.
The Android framework provides a location API - see Location Services and Location Strategies for more information.
To answer your question: Android can update your location.