0

I've been trying to implement Street View with Huawei HMS - MapKit. I'm kind of stuck so any help would be appreciated.

This is code for GMS which works on Android phones;

    SupportStreetViewPanoramaFragment frag = (SupportStreetViewPanoramaFragment)
            getChildFragmentManager().findFragmentById(R.id.streetviewpanorama);

    frag.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() {
        @Override
        public void onStreetViewPanoramaReady(StreetViewPanorama streetViewPanorama) {
            streetViewPanorama.setPosition(new LatLng(-33.87365, 151.20689));
        }
    });

This is the HMS version ;

    com.huawei.hms.maps.SupportStreetViewPanoramaFragment hStreetViewPanoramaFragment =
            (com.huawei.hms.maps.SupportStreetViewPanoramaFragment) 
            getChildFragmentManager().findFragmentById(R.id.streetviewpanoramahuawei);
    
    hStreetViewPanoramaFragment.getStreetViewPanoramaAsync(new com.huawei.hms.maps.OnStreetViewPanoramaReadyCallback() {
        @Override
        public void onStreetViewPanoramaReady(com.huawei.hms.maps.StreetViewPanorama streetViewPanorama) {
            streetViewPanorama.setPosition(new com.huawei.hms.maps.model.LatLng(-33.87365, 151.20689));

        }
    });

They are pretty much the same (with one using GMS classes and the other HMS classes)

When I try this above code, the fragment is initialized and getStreetViewPanoramaAsync is called, but the onStreetViewPanoramaReady callback never gets fired. On GMS however, when I do the same thing, the callback is fired with the Panorama object and the Street View image is shown.

I've also cheked : https://developer.huawei.com/consumer/en/doc/hmssdk_map_conversion_guide The 5th section is dedicated to streetViewPanoramaFragment, I wasn't able to make the project run after using the HMS converter due to some gradle dependency collisions and stuff, but it seems like internally the classes in the package org.xms.g are mostly to encapsulate GMS and HMS classes into one class and return the appropriate one depending on the phone you are using. So basically when using a Huawei phone, the org.xms.g classes return com.huawei.hms classes which pretty much results in the HMS code I shared above.

Anyone who has an idea about what is wrong?

Thanks in advance for the answers!

Evren U
  • 51
  • 1
  • 7

0 Answers0