Giter Club home page Giter Club logo

tajchert / huawei-mobile-services-with-gps Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 2.0 310 KB

Sample integration of Huawei Mobile Services (HMS, Map Kit) for existing app with Google Mobile Services. This repo show how to create HMS flavour of your app and split GPS/HMS imports when using Android Architecture components (LiveData and ModelView).

License: Apache License 2.0

Kotlin 100.00%
hms huawei huawei-mobile-services google-maps-android android

huawei-mobile-services-with-gps's Introduction

Huawei-Mobile-Services-with-GPS

Sample integration of Huawei Mobile Services (HMS, Map Kit) for existing app with Google Mobile Services. This repo show how to create HMS flavor of your app and split GPS/HMS imports when using Android Architecture components (LiveData and ModelView).

This sample show Map (HMS or GPS) and when button Randomize is pressed generates 1000 random points with custom icons on map.

Screenshot

Why

To show how to integrate both HMS and GPS services side-by-side. It is done using 2 flavors, to visualize how many object that you wouldn't expect are provider-dependent (ex. LatLng or BitmapDescriptor just to name few in such simple use case).

How to run it?

  • For HMS flavor:
    • Huawei device (with HMS), otherwise map will result in error. But it will build fine.
    • agconnect-services.json(/app level) that you can obtain from Huawei Developer Console link on how to do it.
  • For GPS flavor:
    • Obtain Google Map key and put it inside mapKeysFile.properties on root level ex. googleMapsKey="YOUR_API_KEY_HERE".
    • Obtain google-services.json(/app level) that you can obtain from Google Firebase Console.
    • Device with GPS.

HMS Map Errors

If you got error when map is showing:

  • getRemoteContext: DynamicModule load failedcom.huawei.hms.feature.dynamic.DynamicModule$LoadingException: Query huawei_module_maps unavailable, errorCode:2
  • getRemoteContext: DynamicModule load failedcom.huawei.hms.feature.dynamic.DynamicModule$LoadingException: Query huawei_module_maps unavailable, errorCode:4
  • getRemoteMapContext failed
  • HmsMapKit_HmsUtil_88: Hms is :0

That mean device is not Huawei and is not eligible for HMS Map Kit. If code is other number - check HMS documentation here.

I have other service that I'm trying to use

I'm open to pull requests. This is just sample on probably most used Google and Huawei SDK to visualize what is needed and how it affects your code (assuming basic architecture) and a good starting point.

TODO

  • Fetching current location
  • Repository for providing mock data
  • Automatic testing

huawei-mobile-services-with-gps's People

Contributors

tajchert avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.