Foody
Foody

Reputation: 187

(Flutter) Huawei Location Kit - longitude and latitude null

I am trying to use Huawei Location Kit(Fused Location Service) to get longitude and latitude. But the response I get back are all null. 

Then, I call the requestLocationUpdates() method to obtain the device location and update the cache. But I got PlatformException. May I know why?

enter image description here

enter image description here

My current code to use Huawei Location Kit:

enter image description here

enter image description here

enter image description here

enter image description here

Log: enter image description here

Upvotes: 2

Views: 1182

Answers (2)

zhangxaochen
zhangxaochen

Reputation: 34027

In the new Location kit 6.0.0 version, Non-Huawei Android phones support only Fused location capability. See Docs.

In addition, only some interfaces are supported. Docs link.

The requestLocationUpdates interface you use here is not supported by Non-Huawei Android phones. You are advised to use the requestLocationUpdatesCb interface instead.

Or you could use version 5.1.0.303 of the Flutter plug-in.

Upvotes: 0

coollei
coollei

Reputation: 51

I tried your code in the project, it seems working.

Can you check whether agconnect-services.json and key file is put in correct place like this:

Project screenshot:

enter image description here

and the API has been enabled in AppGallery Connect:

AGConnect Screenshot:

enter image description here

Upvotes: 2

Related Questions