protected override void OnCreate(Bundle savedInstanceState)
        {
            Log.Debug(TAG, "OnCreate: ");
            base.OnCreate(savedInstanceState);

            HuaweiMapOptions huaweiMapOptions = new HuaweiMapOptions();

            huaweiMapOptions.InvokeCompassEnabled(true);
            huaweiMapOptions.InvokeZoomControlsEnabled(true);
            huaweiMapOptions.InvokeScrollGesturesEnabled(true);
            huaweiMapOptions.InvokeZoomGesturesEnabled(true);

            mMapView = new MapView(this, huaweiMapOptions);
            Bundle mapViewBundle = null;

            if (savedInstanceState != null)
            {
                mapViewBundle = savedInstanceState.GetBundle(MAPVIEW_BUNDLE_KEY);
            }
            // please replace "Your API key" with api_key field value in
            // agconnect-services.json if the field is null.
            MapsInitializer.SetApiKey(Constants.API_KEY);
            mMapView.OnCreate(mapViewBundle);
            mMapView.GetMapAsync(this);

            SetContentView(mMapView);
        }
Exemple #2
0
        public void Initialize()
        {
            LatLng southwest = new LatLng(30, 118);

            CameraPosition.Builder builder        = new CameraPosition.Builder();
            CameraPosition         cameraPosition =
                builder.Target(southwest).Zoom(2).Bearing(2.0f).Tilt(2.5f).Build();
            HuaweiMapOptions huaweiMapOptions = new HuaweiMapOptions().InvokeCamera(cameraPosition);

            mSupportMapFragment = SupportMapFragment.NewInstance(huaweiMapOptions);
            mSupportMapFragment.GetMapAsync(this);
            AndroidX.Fragment.App.FragmentManager     fragmentManager     = SupportFragmentManager;
            AndroidX.Fragment.App.FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();
            fragmentTransaction.Add(Resource.Id.frame_supportmapcode, mSupportMapFragment);
            fragmentTransaction.Commit();
        }
Exemple #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Log.Debug(TAG, "OnCreate: ");
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_mapfragmentcode_demo);
            HuaweiMapOptions huaweiMapOptions = new HuaweiMapOptions();

            huaweiMapOptions.InvokeCompassEnabled(true);
            huaweiMapOptions.InvokeZoomGesturesEnabled(true);
            mMapFragment = MapFragment.NewInstance(huaweiMapOptions);
            FragmentManager     fragmentManager     = FragmentManager;
            FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();

            fragmentTransaction.Add(Resource.Id.frame_mapfragmentcode, mMapFragment);
            fragmentTransaction.Commit();

            mMapFragment.GetMapAsync(this);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Log.Debug(TAG, "OnCreate: ");
            base.OnCreate(savedInstanceState);

            HuaweiMapOptions huaweiMapOptions = new HuaweiMapOptions();

            huaweiMapOptions.InvokeLiteMode(true);
            huaweiMapOptions.InvokeCompassEnabled(true);
            huaweiMapOptions.InvokeZoomControlsEnabled(true);
            huaweiMapOptions.InvokeScrollGesturesEnabled(true);
            huaweiMapOptions.InvokeZoomGesturesEnabled(true);
            mMapView = new MapView(this, huaweiMapOptions);
            Bundle mapViewBundle = null;

            if (savedInstanceState != null)
            {
                mapViewBundle = savedInstanceState.GetBundle(MAPVIEW_BUNDLE_KEY);
            }

            mMapView.OnCreate(mapViewBundle);
            mMapView.GetMapAsync(this);
            SetContentView(mMapView);
        }
        public void OnMapReady(HuaweiMap map)
        {
            Log.Debug(TAG, "OnMapReady: ");
            hMap = map;
            hMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(48.893478, 2.334595), 10));

            HuaweiMapOptions huaweiMapOptions = new HuaweiMapOptions();


            var AmbientEnabled = huaweiMapOptions.AmbientEnabled;

            Log.Debug(TAG, "AmbientEnabled: " + AmbientEnabled.ToString());



            huaweiMapOptions.InvokeCamera(hMap.CameraPosition);
            huaweiMapOptions.InvokeLatLngBoundsForCameraTarget(new LatLngBounds(new LatLng(10, 21), new LatLng(15, 21)));


            var Camera = huaweiMapOptions.Camera;

            Log.Debug(TAG, "Camera: " + Camera.ToString());



            var CompassEnabled = huaweiMapOptions.CompassEnabled;

            Log.Debug(TAG, "CompassEnabled: " + CompassEnabled.ToString());



            var LatLngBoundsForCameraTarget = huaweiMapOptions.LatLngBoundsForCameraTarget;

            Log.Debug(TAG, "LatLngBoundsForCameraTarget: " + LatLngBoundsForCameraTarget.ToString());


            var LiteMode = huaweiMapOptions.LiteMode;

            Log.Debug(TAG, "LiteMode: " + LiteMode.ToString());


            var MapToolbarEnabled = huaweiMapOptions.MapToolbarEnabled;

            Log.Debug(TAG, "MapToolbarEnabled: " + MapToolbarEnabled.ToString());


            var MapType = huaweiMapOptions.MapType;

            Log.Debug(TAG, "MapType: " + MapType.ToString());


            var MinZoomPreference = huaweiMapOptions.MinZoomPreference;

            Log.Debug(TAG, "MinZoomPreference: " + MinZoomPreference.ToString());


            var RotateGesturesEnabled = huaweiMapOptions.RotateGesturesEnabled;

            Log.Debug(TAG, "RotateGesturesEnabled: " + RotateGesturesEnabled.ToString());



            var ScrollGesturesEnabled = huaweiMapOptions.ScrollGesturesEnabled;

            Log.Debug(TAG, "ScrollGesturesEnabled: " + ScrollGesturesEnabled.ToString());



            var TiltGesturesEnabled = huaweiMapOptions.TiltGesturesEnabled;

            Log.Debug(TAG, "TiltGesturesEnabled: " + TiltGesturesEnabled.ToString());


            huaweiMapOptions.InvokeUseViewLifecycleInFragment(false);
            var UseViewLifecycleInFragment = huaweiMapOptions.UseViewLifecycleInFragment;

            Log.Debug(TAG, "UseViewLifecycleInFragment: " + UseViewLifecycleInFragment.ToString());


            huaweiMapOptions.InvokeZOrderOnTop(true);
            var ZOrderOnTop = huaweiMapOptions.ZOrderOnTop;

            Log.Debug(TAG, "ZOrderOnTop: " + ZOrderOnTop.ToString());



            var MaxZoomPreference = huaweiMapOptions.MaxZoomPreference;

            Log.Debug(TAG, "MaxZoomPreference: " + MaxZoomPreference.ToString());



            var ZoomControlsEnabled = huaweiMapOptions.ZoomControlsEnabled;

            Log.Debug(TAG, "ZoomControlsEnabled: " + ZoomControlsEnabled.ToString());



            var ZoomGesturesEnabled = huaweiMapOptions.ZoomGesturesEnabled;

            Log.Debug(TAG, "ZoomGesturesEnabled: " + ZoomGesturesEnabled.ToString());



            var DescribeContents = huaweiMapOptions.DescribeContents();

            Log.Debug(TAG, "DescribeContents: " + DescribeContents.ToString());
        }