浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。

文档全面上新

更科技的视觉体验,更高效的页面结构,快前往体验吧!

体验新版
Android AR识别SDK
产品简介

百度地图Android AR识别SDK是为Android移动平台提供的一套以AR方式展示目标点的服务接口,SDK提供了把目标点从常规地图中的二维平面展示转换成在现实三维空间展示的功能,开发者通过简单的SDK调用即可进行地图AR相关功能开发。SDK提供多种能力接口,开发者可以自定义单目标点展示、自定义多目标点展示,还可调用AR景区、AR识楼功能,开发者也可结合地图SDK检索功能,实现周边目标信息的三维立体展示,从而更加清晰方便地展示目标点在空间中的位置。

功能简介
  • 自定义数据展示
    简介
    自定义单点/多点目标展示, 用户可以将单个或者多个目标点的名称以及位置信息传递给Android AR识别SDK, 就可以通过手机在三维空间展示出目标点的名称、目标点的距离信息,点击气泡点,可回调通知调用。
    功能展示
    1、单点目标
    //1、ArLatLng类用于开发者自定义的目标点信息,传递经纬度
    ArLatLng arLatLng = new ArLatLng(40.082545, 116.376188);
    //2、ArPoiInfo类用于开发者传递经纬度ArLatLng对象和自定义名称
    ArPoiInfo poiInfo = new ArPoiInfo();
    //3、PoiInfoImpl类用于ArPoiInfo对象的存储
    PoiInfoImpl poiImpl = new PoiInfoImpl();
    //4、最后在ArActivity的SimpleSensor.OnHoldPositionListener 传感器监听类中传递给mCamGLView中进行显示,调用方法:
    mCamGLView.setFindArSensorState(remapValue, getLayoutInflater(),mArPoiItemRl, ArActivity.this, poiInfos, ArActivity.this);
    
    2、多目标点
    //1、ArLatLng类用于开发者自定义多个目标点信息,传递经纬度
    private ArLatLng[] latLngs = {new ArLatLng(40.082545, 116.376188), new ArLatLng(40.04326, 116.376781),
    new ArLatLng(40.043204, 116.300784)...}
    //2、遍历多目标点信息,存储到PoiInfoImpl对象中
    poiInfos = new ArrayList<PoiInfoImpl>();
        int i = 0;
        for (ArLatLng all : latLngs) {
        ArPoiInfo pTest = new ArPoiInfo();
        pTest.name = "testPoint" + i++;
        pTest.location = all;
        PoiInfoImpl poiImplT = new PoiInfoImpl();
        poiImplT.setPoiInfo(pTest);
        poiInfos.add(poiImplT);
        }
        //3、最后在ArActivity的SimpleSensor.OnHoldPositionListener 传感器监听类中传递给mCamGLView中进行显示,调用方法:
        mCamGLView.setFindArSensorState(remapValue, getLayoutInflater(),mArPoiItemRl, ArActivity.this, poiInfos, ArActivity.this);
    
    http://mapopen-pub-androidsdk.cdn.bcebos.com/ar/videos/Ar-points.mp4
  • AR景区
    简介
    开发者传递景区的uid信息进入相应的景区视图,SDK通过开发者的定位信息判断,若当前位置在景区外,展示景区主点信息,若在景区内,展示景区子点信息 。点击展示气泡,可传递点击信息进行交互。
    功能展示
    // 获取地图ArSdkManager管理类
    ArSdkManager  mArSdkManager = ArSdkManager.getInstance();
    // 传递景区uid
    mArSdkManager.searchSceneryInfo("2a7a25ecf9cf13636d3e1bad");
    // 调用类实现OnGetDataResultListener监听,用于接收Android AR识别SDK回调数据信息
    /**
     * 返回景区数据,跳转到景区Activity
     * @param arSceneryResponse
     */
    @Override
    public void onGetSceneryResult(ArSceneryResponse arSceneryResponse) {
    }
    // 获取景区信息后跳转到景区展示Activity,展现Activity实现传感器监听,进行渲染
    
    
    private class HoldPositionListenerImp implements SimpleSensor.OnHoldPositionListener {
        @Override
        public void onOrientationWithRemap(float[] remapValue) {
            if (mCamGLView != null && mInfo != null) {
                if (mInfo.getIsInAoi() && mInfo.getSon() != null && mInfo.getSon()
                        .size() > 0) {
                    // 在景区则传入子点集合
                    mCamGLView.setScenerySensorState(remapValue, getLayoutInflater(),
                            mArPoiItemRl, SceneryArActivity.this, mInfo.getSon(), SceneryArActivity.this);
                    mInfo.getFather().setShowInAr(false);
                } else {
                    // 不在景区则传入父点
                    ArrayList<ArPoiScenery> father = new ArrayList<>();
                    mInfo.getFather().setShowInAr(true);
                    father.add(mInfo.getFather());
                    for (int i = 0; i < mInfo.getSon().size(); i++) {
                        mInfo.getSon().get(i).setShowInAr(false);
                    }
                    mCamGLView.setScenerySensorState(remapValue, getLayoutInflater(),
                            mArPoiItemRl, SceneryArActivity.this, father, SceneryArActivity.this);
                }
            }
        }
    }
    
    http://mapopen-pub-androidsdk.cdn.bcebos.com/ar/videos/Ar-scenic.mp4
  • AR识楼
    简介
    Android AR识别SDK提供周边楼块AR展示接口,开发者仅需调用API接口,就可以直接使用地图楼块信息数据,Android AR识别SDK会根据使用者当前位置,对周边楼块进行AR展示。 用户可以点击楼块气泡,获取点击回调。
    功能展示
    // 获取地图ArSdkManager管理类
    ArSdkManager  mArSdkManager = ArSdkManager.getInstance();
    // 调用Android AR识别SDK获取楼块信息
    mArSdkManager.searchBuildingInfo();
    // 调用类实现OnGetDataResultListener监听,用于接收Android AR识别SDK回调数据信息
    /**
     * 返回楼块数据,跳转到识楼Activity
     * @param arResponse
     */
    @Override
    public void onGetBuildingResult(ArBuildingResponse arResponse) {
    }
    
    // 获取景区信息后跳转到景区展示Activity,展现Activity实现传感器监听,进行渲染
    
    private class HoldPositionListenerImp implements SimpleSensor.OnHoldPositionListener {
        @Override
        public void onOrientationWithRemap(float[] remapValue) {
            if (mCamGLView != null && mArPoiItemRl != null && arBuildingResponse != null) {
                if (arBuildingResponse.getBuildings() == null) {
                    mArPoiItemRl.setVisibility(View.GONE);
                    //                    mMessageTv.setText("附近没有可识别的楼宇");
                } else {
                    mCamGLView.setBaseArSensorState(remapValue, getLayoutInflater(), mMessageTv,
                            mArPoiItemRl, BuildingArActivity.this, arBuildingResponse.getBuildings(),
                            BuildingArActivity.this);
                    mArPoiItemRl.setVisibility(View.VISIBLE);
                }
            }
        }
    }
                     
    http://mapopen-pub-androidsdk.bj.bcebos.com/ar/videos/Ar_floor.mp4
  • AR探索
    简介
    Android AR识别SDK可以结合地图SDK检索功能实现周边探索,开发者调用此功能前需要一起下载地图SDK检索功能,并根据要求进行集成配置,然后调用SDK检索功能,等待返回相关数据后,用Android AR识别SDK进行展示。集成地图SDK检索功能方法请参见检索相关文档;以下重点展示请求数据和返回数据调用Android AR识别SDK的方法。
    功能展示
     // 调用检索SDK方法,获取检索数据
    searchNearbyProcess();
    // 实现检索数据监听OnGetPoiSearchResultListener,终点
    
    @Override
    public void onGetPoiResult(PoiResult result) {
    
        if (result.error == SearchResult.ERRORNO.NO_ERROR) {
            poiInfos = new ArrayList<PoiInfoImpl>();
    // 对检索返回数据进行包装,并掉转到展示Activity
            for (PoiInfo poi : result.getAllPoi()) {
                ArPoiInfo poiInfo = new ArPoiInfo();
                ArLatLng arLatLng = new ArLatLng(poi.location.latitude, poi.location.longitude);
                poiInfo.name = poi.name;
                poiInfo.location = arLatLng;
                PoiInfoImpl poiImpl = new PoiInfoImpl();
                poiImpl.setPoiInfo(poiInfo);
                poiInfos.add(poiImpl);
            }
            Toast.makeText(this, "查询到: " + poiInfos.size() + " ,个POI点", Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(MainActivity.this, ArActivity.class);
            MainActivity.this.startActivity(intent);
            return;
        }
        if (result.error == SearchResult.ERRORNO.AMBIGUOUS_KEYWORD) {
    
            // 当输入关键字在本市没有找到,但在其他城市找到时,返回包含该关键字信息的城市列表
            String strInfo = "在";
            for (CityInfo cityInfo : result.getSuggestCityList()) {
                strInfo += cityInfo.city;
                strInfo += ",";
            }
            strInfo += "找到结果";
            Toast.makeText(this, strInfo, Toast.LENGTH_LONG)
                    .show();
        }
    }
    
    http://mapopen-pub-androidsdk.cdn.bcebos.com/ar/videos/Ar-explore.mp4
用户须知

您需申请密钥(AK)后,才可使用百度地图Android AR识别SDK。在您使用百度地图Android AR识别SDK之前,请先阅读百度地图API使用条款

开始使用

  • 文档根本没法用

  • 文档水平很差

  • 文档水平一般

  • 文档不错

  • 文档写的很好

如发现文档错误,或对此文档有更好的建议,请在下方反馈。问题咨询请前往反馈平台提交工单咨询。

提交反馈

拖动标注工具

添加矩形标注

添加箭头标注

完成

取消