Android Baidu Map SDK v3.0.0 (iii) Add overlay marker and Infowindow use

Source: Internet
Author: User

Required Permissions:

?

<!-- This permission is used for network positioning -

<uses-permissionandroid:name="Android.permission.ACCESS_COARSE_LOCATION" >

</uses-permission>

<!-- This permission is used to access GPS positioning --

<uses-permissionandroid:name="Android.permission.ACCESS_FINE_LOCATION">

</uses-permission>

<!-- used to access wifi network information,WiFi information will be used for network location --

<uses-permissionandroid:name="Android.permission.ACCESS_WIFI_STATE" >

</uses-permission>

<!-- get carrier information to support the interface that provides carrier-related information -

<uses-permissionandroid:name="Android.permission.ACCESS_NETWORK_STATE" >

</uses-permission>

<!-- This permission is used to obtain wifi access,WiFi information is used for network location --

<uses-permissionandroid:name="Android.permission.CHANGE_WIFI_STATE">

</uses-permission>

<!-- used to read the current state of the phone -

<uses-permissionandroid:name="Android.permission.READ_PHONE_STATE">

</uses-permission>

<!-- Write extended storage, write data to the expansion card for writing offline location data -

<uses-permissionandroid:name="Android.permission.WRITE_EXTERNAL_STORAGE">

</uses-permission>

<!-- Internet access is required for network location -

<uses-permissionandroid:name="Android.permission.INTERNET"/>

<!--SD card Read permission, user writes offline location data -

<uses-permissionandroid:name="Android.permission.MOUNT_UNMOUNT_FILESYSTEMS" >

</uses-permission>

<!-- allow the app to read low-level system log files -

<uses-permissionandroid:name="Android.permission.READ_LOGS">

?

Add Jar Package: Locsdk_5.0.jar and the Baidumapapi.jar

To add a Send broadcast:

Private void InitManager () {

???????? Sdkinitializer. Initialize (Getapplicationcontext ());

???????? baidusdkreceiver = new mybaidusdkreceiver ();

???????? Intentfilter filter = new intentfilter ();

???????? Filter.addaction (Sdkinitializer. Sdk_broadcast_action_string_network_error );

???????? Filter.addaction (Sdkinitializer. Sdk_broadtcast_action_string_permission_check_error );

???????? Registerreceiver (baidusdkreceiver, filter);

?

????}

Thermal induction, the most or least widely used population

Satellite topography, the type of vehicle needed for travel

Baidumap: Handling Map Events

Setonmapclicklistener () Setting up a map click event Listener

????对mapview添加OnMapClickListener事件监听,监听中有两个方法,public void onMapClick(LatLng point){ }获取到的是空白地点的坐标; public boolean onMapPoiClick(MapPoi poi){ }获取到的是标记的建筑名称

?

Setonmarkerclicklistener ():

Real-time Traffic infographic: baidumap.settrafficenabled (TRUE);

Satellite map: Baidumap.setmaptype (baidumap.map_type_satellite);

Satellite map is the real geographical appearance of satellite photography, so the satellite map can be used to detect the map information, you can learn the geographical location, topography and so on.

Selector What happens if you choose to choose? Defined in XML

hierarchical capping relationships of map coverings (order from top to bottom):

    1. Base Basemap (including Basemaps, Basemap roads, satellite maps, etc.)
    2. Topographic map layer (Groundoverlay)
    3. Thermal Diagram Layer (heatmap
    4. Real-time Traffic graph layer (baidumap.settrafficenabled (true)),
    5. Baidu City Thermal Map (baidumap.setbaiduheatmapenabled (true)),
    6. Basemap callout (refers to which POI elements are on top of the Basemap)
    7. Geometry layers: (points, folds, arcs, elements, polygons)
    8. Callout Layer (Marker) Text draw layer (text)
    9. Compass layer (The compass appears by default in the upper-left corner when the local map rotates and the perspective changes)
    10. Position Layer (baidumap.setmylocationenabled (true))
    11. Pop-up block diagram layer (Infowindow)
    12. Custom View (Mapview.addview view)

?

To add a layer picture:

Circleoptions circleoptions=new circleoptions ();

Circleoptions.center (MPos)//Center

. Radius (FillColor) (0x50ffff00). Stroke (New stroke ());//

Properties: Visible (Boolean visible)//Whether the garden is visible???? Park ZIndex (Show priority)

Add layer Text:

Textoptions

Markeroptions: Set the position coordinates of the marker overlay, position (latlng position)

???? Sets the title of the marker overlay. Title (Java)

Positioning

Locationclient and Bdlocationlistener Monitoring

First you need to open the anchor layer baidumap.setmylocationenabled (TRUE);

Set Listener Locationclient.registerlocationlistener (Bdlocationlistener)

Set the positioning mode: Baidumap.

?

?

Review Local Search overlay "Poioverlay", Route planning

?

?

?

Android Baidu Map SDK v3.0.0 (iii) Add overlay marker and Infowindow use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.