Coder Social home page Coder Social logo

supasintatiyanupanwong / map-kit-android Goto Github PK

View Code? Open in Web Editor NEW
45.0 2.0 11.0 1.68 MB

An extensive framework for map development in Android.

License: Apache License 2.0

Java 100.00%
android google-maps huawei-maps android-library java huawei-map-kit map-kit google-maps-android gms hms

map-kit-android's Introduction

Map Kit

Maven Central javadoc license

Map Kit is an extensive framework for map development in Android.

Architecture

The library consists of 4 artifacts; maps-core, maps-google, maps-amazon, and maps-huawei.

maps-core artifact provides an extensive framework for map development in Android.

maps-google artifact provides the Google Maps SDK integration to the Map Kit.

maps-amazon artifact provides the Amazon Maps SDK integration to the Map Kit.

maps-huawei artifact provides the HUAWEI Map Kit integration to the Map Kit.

Usage

Migrating from the existing APIs

Google Maps SDK Amazon Maps SDK HUAWEI Map Kit Map Kit
SupportMapFragment SupportMapFragment SupportMapFragment MapFragment
GoogleMap AmazonMap HuaweiMap MapClient
new LatLng() new LatLng() new LatLng() MapKit.newLatLng()
new *Options() new *Options() new *Options() MapKit.new*Options()
*.builder() *.builder() *.builder() MapKit.new*Builder()
*Factory.*() *Factory.*() *Factory.*() MapKit.get*Factory().*()

Limitation

  • Models are not Parcelable.
  • MapOptions is currently not supported.
  • StreetView is currently not supported.

Declaring dependencies

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    // Optional - To grant access to the Map Kit API without platform specific implementation
    implementation 'dev.supasintatiyanupanwong.libraries.android.kits.maps:maps-core:2.3.0'

    // To use the Google Maps SDK via Map Kit
    implementation 'dev.supasintatiyanupanwong.libraries.android.kits.maps:maps-google:2.3.0'

    // To use the Amazon Maps SDK via Map Kit
    implementation 'dev.supasintatiyanupanwong.libraries.android.kits.maps:maps-amazon:2.3.0'
    implementation files('amazon-maps-api-v2.aar')

    // To use the HUAWEI Map Kit via Map Kit
    implementation 'dev.supasintatiyanupanwong.libraries.android.kits.maps:maps-huawei:2.3.0'
}

If multiple integration artifacts are included in your final build, the implementation will be selected based on API availability upon application startup.

However, it is possible to separate builds between them as next:

android {
    // ...
    flavorDimensions 'vendor'
    productFlavors {
        google
        amazon { applicationIdSuffix '.amazon' }
        huawei { applicationIdSuffix '.huawei' }
    }
}

dependencies {
    googleImplementation 'dev.supasintatiyanupanwong.libraries.android.kits.maps:maps-google:2.3.0'

    amazonImplementation 'dev.supasintatiyanupanwong.libraries.android.kits.maps:maps-amazon:2.3.0'
    amazonImplementation files('amazon-maps-api-v2.aar')

    huaweiImplementation 'dev.supasintatiyanupanwong.libraries.android.kits.maps:maps-huawei:2.3.0'
}

For more information about dependencies, see Add build dependencies.

Additional documentation

Feedback

Your feedback helps make Map Kit better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues or the existing discussions in this library before you create a new one.

License

Copyright 2020 Supasin Tatiyanupanwong

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

map-kit-android's People

Contributors

ljarka avatar supasintatiyanupanwong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

map-kit-android's Issues

Cluster support

Hi, is cluster feature available in the lib?

I've been reviewing the examples and I cannot find any example.

Thank you

Request. Fragment sample

Can you provide a sample featuring a Fragment that contains the MapFragment? The samples are all Activities.

Feature Request. SupportMapFragment

possible to add a generic of this class? Both google and huawei have their own separate classes for SupportMapFragment

com.huawei.hms.maps.SupportMapFragment
om.google.android.gms.maps.SupportMapFragment

[Request] Need override the onCreateView in MapFragment

onCreateView method in this library is final to prevent the method overriding in subclass

But in my use case, I have a reason to override this method. I have another wrapper view to handle the user gesture on the map by itself.

For example

class CustomMapFragment: MapFragment() {
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?, 
        savedInstanceState: Bundle?
    ) {
        val mapView = inflater.inflate(MapsPlatform.get().getFragmentLayoutId(), container, false)
        val wrapperView = WrapperView(requireContext())
        wrapperView.addView(mapView)
        return wrapperView
    }
}

Can you remove final in onCreateView method or is there any solution?

Consumer proguard rules needed as of AGP 4.1.0

Hi, I got an error after upgrading to AGP version 4.1.0:
java.lang.RuntimeException: Unable to get provider me.tatiyanupanwong.supasin.android.libraries.kits.maps.MapKitInitProvider: java.lang.IllegalStateException: Can't find supported platform, make sure to include one of the next artifacts: ':maps-amazon', ':maps-google', or ':maps-huawei'
However, I did not change anything related to artifacts.

I have resolved the issue by adding following line to proguard rules:
-keep public class me.tatiyanupanwong.supasin.android.libraries.kits.maps.** { *; }

Error inflating class fragment

Fatal Exception: android.view.InflateException: Binary XML file line #18: Error inflating class fragment

Fatal Exception: android.view.InflateException: Binary XML file line #18: Error inflating class fragment
       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
       at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
       at dev.supasintatiyanupanwong.libraries.android.kits.maps.MapFragment.onCreateView(MapFragment.java:73)
       at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2963)
       at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:518)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:282)
       at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
       at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
       at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
       at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
       at androidx.fragment.app.Fragment.performResume(Fragment.java:3048)
       at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
       at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:112)
       at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1647)
       at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3128)
       at androidx.fragment.app.FragmentManager.dispatchResume(FragmentManager.java:3086)
       at androidx.fragment.app.Fragment.performResume(Fragment.java:3048)
       at androidx.fragment.app.FragmentStateManager.resume(FragmentStateManager.java:607)
       at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:306)
       at androidx.fragment.app.SpecialEffectsController$FragmentStateManagerOperation.complete(SpecialEffectsController.java:745)
       at androidx.fragment.app.SpecialEffectsController$Operation.completeSpecialEffect(SpecialEffectsController.java:672)
       at androidx.fragment.app.DefaultSpecialEffectsController$SpecialEffectsInfo.completeSpecialEffect(DefaultSpecialEffectsController.java)
       at androidx.fragment.app.DefaultSpecialEffectsController$2.onAnimationEnd(DefaultSpecialEffectsController.java:190)
       at android.animation.AnimatorSet$AnimatorSetListener.onAnimationEnd(AnimatorSet.java:818)
       at android.animation.AnimatorSet$AnimatorSetListener.onAnimationEnd(AnimatorSet.java:818)
       at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1056)
       at android.animation.ValueAnimator.access$400(ValueAnimator.java:50)
       at android.animation.ValueAnimator$AnimationHandler.doAnimationFrame(ValueAnimator.java:644)
       at android.animation.ValueAnimator$AnimationHandler.run(ValueAnimator.java:660)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788)
       at android.view.Choreographer.doCallbacks(Choreographer.java:591)
       at android.view.Choreographer.doFrame(Choreographer.java:559)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)
       at android.os.Handler.handleCallback(Handler.java:808)
       at android.os.Handler.dispatchMessage(Handler.java:103)
       at android.os.Looper.loop(Looper.java:193)
       at android.app.ActivityThread.main(ActivityThread.java:5292)
       at java.lang.reflect.Method.invokeNative(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:515)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
       at dalvik.system.NativeStart.main(NativeStart.java)

Urgent. App now crashes canot find map platform for maps

Did the method in google maps platform change perhaps in the new maps?
keeps crashing because of this

  Process: org.droidgox.phivolcs, PID: 9109
java.lang.RuntimeException: Unable to get provider dev.supasintatiyanupanwong.libraries.android.kits.maps.MapKitInitProvider: java.lang.IllegalStateException: Can't find supported platform, make sure to include one of the next artifacts: ':maps-amazon', ':maps-google', or ':maps-huawei'
at android.app.ActivityThread.installProvider(ActivityThread.java:8173)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7709)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7573)
at android.app.ActivityThread.access$2600(ActivityThread.java:260)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2435)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8668)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)
Caused by: java.lang.IllegalStateException: Can't find supported platform, make sure to include one of the next artifacts: ':maps-amazon', ':maps-google', or ':maps-huawei'
at dev.supasintatiyanupanwong.libraries.android.kits.maps.MapsPlatform.findPlatform(MapsPlatform.java:68)
at dev.supasintatiyanupanwong.libraries.android.kits.maps.MapsPlatform.init(MapsPlatform.java:39)
at dev.supasintatiyanupanwong.libraries.android.kits.maps.MapKitInitProvider.attachInfo(MapKitInitProvider.java:34)
at android.app.ActivityThread.installProvider(ActivityThread.java:8168)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:7709) 
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7573) 
at android.app.ActivityThread.access$2600(ActivityThread.java:260) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2435) 
at android.os.Handler.dispatchMessage(Handler.java:110) 
at android.os.Looper.loop(Looper.java:219) 
at android.app.ActivityThread.main(ActivityThread.java:8668) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109) 

Migration to JCenter

I'm trying to remove JCenter, given it's now at end of life. Is there a plan to migrate away from it?

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.