This commit is contained in:
2020-07-04 14:41:25 +08:00
parent 70c346d2c1
commit a8f02e4da5
3748 changed files with 587372 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d98a696ae64ce41eab55acb4903fc0e1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.tianrun.crm" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<!-- Android9.0对未加密的流量不在信任添加了新的限制。usesCleartextTraffic=true -->
<application android:theme="@style/UnityThemeSelector" android:icon="@mipmap/app_icon" android:label="@string/app_name" android:usesCleartextTraffic="true">
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.baidu.location.f"
android:enabled="true"
android:process=":remote"/>
<!-- "开发者 key ios:B6gC5ufYoGSkM83NUA3qUzebhNT2hmWj"-->
<meta-data android:name="com.baidu.lbsapi.API_KEY"
android:value="SKSH3WE61t5DbLwl6u0GHbn4gEpX04tZ" />
</application>
<uses-feature android:glEsVersion="0x00020000" />
<!-- 访问网络进行地图相关业务数据请求包括地图数据路线规划POI检索等 -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- 获取网络状态,根据网络状态切换进行数据请求网络转换 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- 读取外置存储。如果开发者使用了so动态加载功能并且把so文件放在了外置存储区域则需要申请该权限否则不需要 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- 写外置存储。如果开发者使用了离线地图,并且数据写在外置存储区域,则需要申请该权限 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- 这个权限用于进行网络定位 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 这个权限用于访问GPS定位 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- 用于访问wifi网络信息wifi信息会用于进行网络定位-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<!-- 获取运营商信息,用于支持提供运营商信息相关的接口-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<!-- 这个权限用于获取wifi的获取权限wifi信息会用来进行网络定位-->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
</manifest>

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9c62e9f81ca5148d6b4990bca99a295d
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,181 @@
package com.tianrun;
import android.content.Intent;
import android.provider.Settings;
import com.baidu.location.BDAbstractLocationListener;
import com.baidu.location.BDLocation;
import com.baidu.location.LocationClient;
import com.baidu.location.LocationClientOption;
//import com.baidu.mapapi.SDKInitializer;
import com.unity3d.player.UnityPlayer;
import org.json.JSONObject;
public class BaiduLBS {
public static LocationClient mLocClient;
static String listener;
/**
* 定位SDK监听函数
*/
public static class MyLocationListener extends BDAbstractLocationListener {
@Override
public void onReceiveLocation(BDLocation location) {
if (null != location && location.getLocType() != BDLocation.TypeServerError &&
location.getLocType() != BDLocation.TypeOffLineLocationFail &&
location.getLocType() != BDLocation.TypeCriteriaException) {
// MapView 销毁后不在处理新接收的位置
JSONObject jo = new JSONObject();
try {
jo.put("cmd", "onGetLocation");
if (location == null) {
jo.put("code", -1);
return;
}
// double mCurrentLat = location.getLatitude();
// double mCurrentLon = location.getLongitude();
// double mCurrentAccracy = location.getRadius();
jo.put("code", 0);
jo.put("latitude", String.format("%f", location.getLatitude()));
jo.put("longitude", String.format("%f", location.getLongitude()));
jo.put("AddrStr", location.getAddrStr());
jo.put("locationInfor", location.toString());
sendUnityMsg(jo.toString());
} catch (Exception e) {
System.out.println(e);
}
}
mLocClient.stop();
}
/**
* 回调定位诊断信息,开发者可以根据相关信息解决定位遇到的一些问题
*
* @param locType 当前定位类型
* @param diagnosticType 诊断类型1~9
* @param diagnosticMessage 具体的诊断信息释义
*/
@Override
public void onLocDiagnosticMessage(int locType, int diagnosticType, String diagnosticMessage) {
super.onLocDiagnosticMessage(locType, diagnosticType, diagnosticMessage);
StringBuffer sb = new StringBuffer(256);
sb.append("locType:" + locType);
sb.append("\n" + "诊断结果: ");
if (locType == BDLocation.TypeNetWorkLocation) {
if (diagnosticType == 1) {
sb.append("网络定位成功没有开启GPS建议打开GPS会更好" + "\n");
sb.append(diagnosticMessage);
} else if (diagnosticType == 2) {
sb.append("网络定位成功没有开启Wi-Fi建议打开Wi-Fi会更好" + "\n");
sb.append(diagnosticMessage);
}
} else if (locType == BDLocation.TypeOffLineLocationFail) {
if (diagnosticType == 3) {
sb.append("定位失败,请您检查您的网络状态" + "\n");
sb.append(diagnosticMessage);
}
} else if (locType == BDLocation.TypeCriteriaException) {
if (diagnosticType == 4) {
sb.append("定位失败,无法获取任何有效定位依据" + "\n");
sb.append(diagnosticMessage);
} else if (diagnosticType == 5) {
sb.append("定位失败无法获取有效定位依据请检查运营商网络或者Wi-Fi网络是否正常开启尝试重新请求定位" + "\n");
sb.append(diagnosticMessage);
} else if (diagnosticType == 6) {
sb.append("定位失败无法获取有效定位依据请尝试插入一张sim卡或打开Wi-Fi重试" + "\n");
sb.append(diagnosticMessage);
} else if (diagnosticType == 7) {
sb.append("定位失败,飞行模式下无法获取有效定位依据,请关闭飞行模式重试" + "\n");
sb.append(diagnosticMessage);
} else if (diagnosticType == 9) {
sb.append("定位失败,无法获取任何有效定位依据" + "\n");
sb.append(diagnosticMessage);
}
} else if (locType == BDLocation.TypeServerError) {
if (diagnosticType == 8) {
sb.append("定位失败请确认您定位的开关打开状态是否赋予APP定位权限" + "\n");
sb.append(diagnosticMessage);
}
}
System.out.println(sb.toString());
JSONObject jo = new JSONObject();
try {
jo.put("cmd", "onGetLocation");
jo.put("code", diagnosticType);
jo.put("msg", sb.toString());
sendUnityMsg(jo.toString());
} catch (Exception e) {
System.out.println(e.toString());
}
}
}
public static void init(String _listener, String coorType) {
listener = _listener;
//在使用SDK各组件之前初始化context信息传入ApplicationContext
// SDKInitializer.initialize(UnityPlayer.currentActivity.getApplicationContext());
//自4.3.0起百度地图SDK所有接口均支持百度坐标和国测局坐标用此方法设置您使用的坐标类型.
//包括BD09LL和GCJ02两种坐标默认是BD09LL坐标。
// SDKInitializer.setCoordType(CoordType.BD09LL);
// 初始定位
initLocation(coorType);
}
public static void initLocation(String coorType) {
mLocClient = new LocationClient(UnityPlayer.currentActivity.getApplicationContext());
//声明LocationClient类
mLocClient.registerLocationListener(new MyLocationListener());
//注册监听函数
// 定位初始化
LocationClientOption mOption = new LocationClientOption();
mOption.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy); // 可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
mOption.setCoorType(coorType); // 可选默认gcj02设置返回的定位结果坐标系如果配合百度地图使用建议设置为bd09ll;
// mOption.setScanSpan(3000); // 可选默认0即仅定位一次设置发起连续定位请求的间隔需要大于等于1000ms才是有效的
mOption.setIsNeedAddress(true); // 可选,设置是否需要地址信息,默认不需要
mOption.setIsNeedLocationDescribe(true); // 可选,设置是否需要地址描述
mOption.setNeedDeviceDirect(false); // 可选,设置是否需要设备方向结果
mOption.setLocationNotify(false); // 可选默认false设置是否当gps有效时按照1S1次频率输出GPS结果
mOption.setIgnoreKillProcess(true); // 可选默认true定位SDK内部是一个SERVICE并放到了独立进程设置是否在stop
mOption.setIsNeedLocationDescribe(true); // 可选默认false设置是否需要位置语义化结果可以在BDLocation
mOption.setIsNeedLocationPoiList(true); // 可选默认false设置是否需要POI结果可以在BDLocation
mOption.SetIgnoreCacheException(false); // 可选默认false设置是否收集CRASH信息默认收集
mOption.setOpenGps(true); // 可选默认false设置是否开启Gps定位
mOption.setIsNeedAltitude(false); // 可选默认false设置定位时是否需要海拔信息默认不需要除基础定位版本都可用
mLocClient.setLocOption(mOption);
}
// 取得我的当前位置
//可选设置返回经纬度坐标类型默认GCJ02
//GCJ02国测局坐标
//BD09ll百度经纬度坐标
//BD09百度墨卡托坐标
public static void getMyLocation(String CoorType) {
if (mLocClient != null) {
// if(mLocClient.isStarted()) return;
LocationClientOption option = mLocClient.getLocOption();
if (CoorType != null && CoorType != "") {
option.setCoorType(CoorType);
} else {
option.setCoorType("gcj02");
}
mLocClient.setLocOption(option);
mLocClient.start();
}
}
///打开gps设置
public static void guidSwitchGps() {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
//PermissionConstants.RC_GPS是请求码可以在onActivityResult中根据该请求码判断用户是否已经在设置页面打开位置服务
UnityPlayer.currentActivity.startActivity(intent);
}
public static void sendUnityMsg(String msg) {
UnityPlayer.UnitySendMessage(listener, "onCallback", msg);
}
}

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 37203952a48524b8f98ec5f96a455507
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: df5965f5e9ba945b1b664555c0c983f1
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4e17178e9667b44e5a23b62e0036e51c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8d2b0fe67d62c4062b23255b5e799b57
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 0f970af325d1e429baca6ad6532c78a6
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 0
Exclude Editor: 0
Exclude Linux: 0
Exclude Linux64: 0
Exclude LinuxUniversal: 0
Exclude OSXUniversal: 0
Exclude Win: 0
Exclude Win64: 0
Exclude iOS: 0
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARM64
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 1
settings: {}
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 05ff93018dc684538856ad970768e67c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 0
Exclude Editor: 0
Exclude Linux: 0
Exclude Linux64: 0
Exclude LinuxUniversal: 0
Exclude OSXUniversal: 0
Exclude Win: 0
Exclude Win64: 0
Exclude iOS: 0
- first:
Android: Android
second:
enabled: 1
settings:
CPU: ARM64
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 1
settings: {}
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c4afaf2f3b92f4c9f871c3c17f039d51
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: 453b6af19d68f47fea99fe8dae156f53
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: b7de91178e3514b31a160b22ae29557a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 48752385118814f13a59c7aa27333471
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 8a3a0248195b34ed2852b40990d5b2e8
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 0
Exclude Editor: 0
Exclude Linux: 0
Exclude Linux64: 0
Exclude LinuxUniversal: 0
Exclude OSXUniversal: 0
Exclude Win: 0
Exclude Win64: 0
Exclude iOS: 0
- first:
Android: Android
second:
enabled: 1
settings:
CPU: x86
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 1
settings: {}
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,104 @@
fileFormatVersion: 2
guid: 5a39effa9345c42a98d9f0f61376b0b0
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
'': Any
second:
enabled: 0
settings:
Exclude Android: 0
Exclude Editor: 0
Exclude Linux: 0
Exclude Linux64: 0
Exclude LinuxUniversal: 0
Exclude OSXUniversal: 0
Exclude Win: 0
Exclude Win64: 0
Exclude iOS: 0
- first:
Android: Android
second:
enabled: 1
settings:
CPU: x86
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: Win
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Facebook: Win64
second:
enabled: 0
settings:
CPU: AnyCPU
- first:
Standalone: Linux
second:
enabled: 1
settings:
CPU: x86
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: x86_64
- first:
Standalone: LinuxUniversal
second:
enabled: 1
settings: {}
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
iPhone: iOS
second:
enabled: 1
settings:
AddToEmbeddedBinaries: false
CompileFlags:
FrameworkDependencies:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,22 @@
【欢迎使用百度LBS开放平台Android SDK产品
--------------------------------------------------------------------------------------------
【您当前所选择下载的开发包包含如下功能】
--------------------------------------------------------------------------------------------
全量定位:包含离线定位、室内高精度定位能力,同时提供更人性化的位置描述服务;
--------------------------------------------------------------------------------------------
统一下载平台
【产品说明】
基础定位+离线定位+室内定位 = 全量定位 -> 原Android定位SDK当前版本v8.4.4
基础地图+检索功能+LBS云检索+计算工具+骑行导航 -> 原Android SDK地图SDK当前版本6.3.0
驾车导航含TTS -> 原导航SDK当前版本v4.8.0
全景图功能 -> 原全景图SDK当前版本v2.8.6
AR地图功能 -> 当前版本v1.2.0
--------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9bc641ad026294f75abfc3789ab6af29
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7c3550f37999543768218515ea4288ab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@
fileFormatVersion: 2
guid: 9778f438be37d4559aab720081e55f30
folderAsset: yes
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3c3f0f617cc574c88958594fff15430e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aee1ad44c65854e08baf6311f480d818
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,141 @@
//
// BMKGeoFenceManager.h
// BMKLocationKit
//
// Created by baidu on 2017/3/2.
// Copyright © 2017年 baidu. All rights reserved.
//
#import "BMKGeoFenceRegion.h"
@protocol BMKGeoFenceManagerDelegate;
///地理围栏监听状态类型
typedef NS_OPTIONS(NSUInteger, BMKGeoFenceActiveAction)
{
BMKGeoFenceActiveActionNone = 0, ///< 不进行监听
BMKGeoFenceActiveActionInside = 1 << 0, ///< 在范围内
BMKGeoFenceActiveActionOutside = 1 << 1, ///< 在范围外
BMKGeoFenceActiveActionStayed = 1 << 2, ///< 停留(在范围内超过10分钟)
};
///BMKGeoFence errorDomain
FOUNDATION_EXPORT NSErrorDomain const _Nonnull BMKGeoFenceErrorDomain;
///地理围栏错误码
typedef NS_ENUM(NSInteger, BMKGeoFenceErrorCode) {
BMKGeoFenceErrorUnknown = 1, ///< 未知错误
BMKGeoFenceErrorInvalidParameter = 2, ///< 参数错误
BMKGeoFenceErrorFailureConnection = 3, ///< 网络连接异常
BMKGeoFenceErrorFailureAuth = 4, ///< 鉴权失败
BMKGeoFenceErrorNoValidFence = 5, ///< 无可用围栏
BMKGeoFenceErroFailureLocating = 6, ///< 定位错误
};
///地理围栏管理类
@interface BMKGeoFenceManager : NSObject
///实现了 BMKGeoFenceManagerDelegate 协议的类指针。
@property (nonatomic, weak, nullable) id<BMKGeoFenceManagerDelegate> delegate;
///需要进行通知的行为默认为BMKGeoFenceActiveActionInside。
@property (nonatomic, assign) BMKGeoFenceActiveAction activeAction;
///指定定位是否会被系统自动暂停。默认为NO。
@property (nonatomic, assign) BOOL pausesLocationUpdatesAutomatically;
///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态,否则会抛出异常。
@property (nonatomic, assign) BOOL allowsBackgroundLocationUpdates;
/**
* @brief 添加一个圆形围栏
* @param center 围栏的中心点经纬度坐标
* @param radius 围栏的半径单位要求大于0
* @param type 围栏的坐标系类型
* @param customID 用户自定义ID可选SDK原值返回
*/
- (void)addCircleRegionForMonitoringWithCenter:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius coorType:(BMKLocationCoordinateType)type customID:(NSString * _Nullable)customID;
/**
* @brief 根据经纬度坐标数据添加一个闭合的多边形围栏,点与点之间按顺序尾部相连, 第一个点与最后一个点相连
* @param coordinates 经纬度坐标点数据,coordinates对应的内存会拷贝,调用者负责该内存的释放
* @param count 经纬度坐标点的个数不可小于3个
* @param type 围栏的坐标系类型
* @param customID 用户自定义ID可选SDK原值返回
*/
- (void)addPolygonRegionForMonitoringWithCoordinates:(CLLocationCoordinate2D * _Nonnull)coordinates count:(NSInteger)count coorType:(BMKLocationCoordinateType)type customID:(NSString * _Nullable)customID;
/**
* @brief 根据customID获得指定的围栏如果customID传nil则返回全部围栏
* @param customID 用户执行添加围栏函数时传入的customID
* @return 获得的围栏构成的数组如果没有结果返回nil
*/
- (NSArray * _Nullable)geoFenceRegionsWithCustomID:(NSString * _Nullable)customID;
/**
* @brief 移除指定围栏
* @param region 要停止监控的围栏
*/
- (void)removeTheGeoFenceRegion:(BMKGeoFenceRegion * _Nonnull)region;
/**
* @brief 移除指定customID的围栏
* @param customID 用户执行添加围栏函数时传入的customID
*/
- (void)removeGeoFenceRegionsWithCustomID:(NSString * _Nullable)customID;
/**
* @brief 移除所有围栏
*/
- (void)removeAllGeoFenceRegions;
@end
///地理围栏代理协议,该协议定义了获取地理围栏相关回调方法,包括添加、状态改变等。
@protocol BMKGeoFenceManagerDelegate <NSObject>
@optional
/**
* @brief 为了适配app store关于新的后台定位的审核机制app store要求如果开发者只配置了使用期间定位则代码中不能出现申请后台定位的逻辑当开发者在plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription时需要在该delegate中调用后台定位api[locationManager requestAlwaysAuthorization]。开发者如果只配置了NSLocationWhenInUseUsageDescription且只有使用期间的定位需求则无需在delegate中实现逻辑。
* @param manager 定位 BMKGeoFenceManager 类。
* @param locationManager 系统 CLLocationManager 类 。
* @since 1.7.0
*/
- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager;
/**
* @brief 添加地理围栏完成后的回调,成功与失败都会调用
* @param manager 地理围栏管理类
* @param regions 成功添加的一个或多个地理围栏构成的数组
* @param customID 用户执行添加围栏函数时传入的customID
* @param error 添加失败的错误信息
*/
- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didAddRegionForMonitoringFinished:(NSArray <BMKGeoFenceRegion *> * _Nullable)regions customID:(NSString * _Nullable)customID error:(NSError * _Nullable)error;
/**
* @brief 地理围栏状态改变时回调,当围栏状态的值发生改变,定位失败都会调用
* @param manager 地理围栏管理类
* @param region 状态改变的地理围栏
* @param customID 用户执行添加围栏函数时传入的customID
* @param error 错误信息,如定位相关的错误
*/
- (void)BMKGeoFenceManager:(BMKGeoFenceManager * _Nonnull)manager didGeoFencesStatusChangedForRegion:(BMKGeoFenceRegion * _Nullable)region customID:(NSString * _Nullable)customID error:(NSError * _Nullable)error;
@end

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 02bef3f1d1e52452a8c96ba746dece32
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,114 @@
//
// BMKGeoFenceRegion.h
// BMKLocationKit
//
// Created by baidu on 2017/3/2.
// Copyright © 2017年 baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "BMKLocationManager.h"
///BMKGeoFence Region State
typedef NS_ENUM(NSInteger, BMKGeoFenceRegionStatus)
{
BMKGeoFenceRegionStatusUnknown = 0, ///< 未知
BMKGeoFenceRegionStatusInside = 1, ///< 在范围内
BMKGeoFenceRegionStatusOutside = 1 << 1, ///< 在范围外
BMKGeoFenceRegionStatusStayed = 1 << 2, ///< 停留(在范围内超过10分钟)
};
#pragma mark - BMKGeoFenceRegion
///地理围栏基类,不可直接使用
@interface BMKGeoFenceRegion : NSObject<NSCopying>
///BMKGeoFenceRegion的唯一标识符
@property (nonatomic, copy, readonly) NSString *identifier;
///用户自定义ID可为nil。
@property (nonatomic, copy, readonly) NSString *customID;
///坐标点和围栏的关系,比如用户的位置和围栏的关系
@property (nonatomic, assign) BMKGeoFenceRegionStatus fenceStatus;
///设定围栏坐标系类型。默认为 BMKLocationCoordinateTypeGCJ02。
@property(nonatomic, readonly) BMKLocationCoordinateType coordinateType;
///上次发生状态变化的时间
@property(nonatomic, assign)NSTimeInterval lastEventTime;
/**
* @brief 判断位置与围栏状态
* @param CLLocationCoordinate2D 坐标值
* @return 返回BMKGeoFenceRegionStatus状态
*/
-(BMKGeoFenceRegionStatus)judgeStatusWithCoor:(CLLocationCoordinate2D)coor;
@end
#pragma mark - BMKLocationCircleRegion
///圆形地理围栏
@interface BMKGeoFenceCircleRegion : BMKGeoFenceRegion
///中心点的经纬度坐标
@property (nonatomic, readonly) CLLocationCoordinate2D center;
///半径,单位:米
@property (nonatomic, readonly) CLLocationDistance radius;
/**
* @brief 构造圆形围栏
* @param customid 用户自定义ID
* @param identityid 识别id
* @param center 中心坐标
* @param radius 围栏半径
* @param type 坐标系类型
* @return BMKGeoFenceCircleRegion id
*/
- (id)initWithCustomID:(NSString *)customid identityID:(NSString *)identityid center:(CLLocationCoordinate2D)center radius:(CLLocationDistance)radius coor:(BMKLocationCoordinateType)type;
@end
#pragma mark -BMKGeoFencePolygonRegion
///多边形地理围栏
@interface BMKGeoFencePolygonRegion : BMKGeoFenceRegion
///经纬度坐标点数据
@property (nonatomic, readonly) CLLocationCoordinate2D *coordinates;
///经纬度坐标点的个数
@property (nonatomic, readonly) NSInteger count;
/**
* @brief 构造多边形围栏
* @param customid 用户自定义ID
* @param identityid 识别id
* @param coor 多边形顶点
* @param count 顶点个数
* @param type 坐标系类型
* @return BMKGeoFencePolygonRegion id
*/
- (id)initWithCustomID:(NSString *)customid identityID:(NSString *)identityid coor:(CLLocationCoordinate2D *)coor count:(NSInteger)count coor:(BMKLocationCoordinateType)type;
@end

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4789a7241b144488b96b7a18615e07c8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
//
// BMKLocation.h
// LocationComponent
//
// Created by baidu on 2017/8/16.
// Copyright © 2017年 baidu. All rights reserved.
//
#ifndef BMKLocation_h
#define BMKLocation_h
#import <CoreLocation/CoreLocation.h>
#import "BMKLocationReGeocode.h"
/**
* BMKLocationProvider 位置数据来源分iOS系统定位和其他定位服务结果两种目前仅支持iOS系统定位服务
*
*/
typedef NS_ENUM(int, BMKLocationProvider) {
BMKLocationProviderIOS = 0, //!<位置来源于iOS本身定位
BMKLocationProviderOther //!<位置来源于其他定位服务
};
///描述百度iOS 定位数据
@interface BMKLocation : NSObject
///BMKLocation 位置数据
@property(nonatomic, copy, readonly) CLLocation * _Nullable location;
///BMKLocation 地址数据
@property(nonatomic, copy) BMKLocationReGeocode * _Nullable rgcData;
///BMKLocation 位置来源
@property(nonatomic, assign) BMKLocationProvider provider;
///BMKLocation 位置ID
@property(nonatomic, retain) NSString * _Nullable locationID;
/*
* floorString
*
* Discussion:
* 室内定位成功时返回的楼层信息ex:f1
*/
@property(readonly, nonatomic, copy, nullable) NSString *floorString;
/*
* buildingID
*
* Discussion:
* 室内定位成功时返回的百度建筑物ID
*/
@property(readonly, nonatomic, copy, nullable) NSString *buildingID;
/*
* buildingName
*
* Discussion:
* 室内定位成功时返回的百度建筑物名称
*/
@property(readonly, nonatomic, copy, nullable) NSString *buildingName;
/*
* extraInfo
*
* Discussion:
* 定位附加信息如停车位code识别结果、停车位code示例、vdr推算结果置信度等
*/
@property(readonly, nonatomic, copy, nullable) NSDictionary * extraInfo;
/**
* @brief 初始化BMKLocation实例
* @param loc CLLocation对象
* @param rgc BMKLocationReGeocode对象
* @return BMKLocation id
*/
- (id _Nonnull)initWithLocation:(CLLocation * _Nullable)loc withRgcData:(BMKLocationReGeocode * _Nullable)rgc;
/**
* @brief 构造BMKLocation
* @param location CLLocation
* @param floorString 楼层字符串
* @param buildingID 建筑物ID
* @param buildingName 建筑物名称
* @param info 位置附加信息
* @return BMKLocation id
*/
-(id _Nonnull)initWithLocation:(CLLocation * _Nullable)location floorString:(NSString * _Nullable)floorString buildingID:(NSString * _Nullable)buildingID
buildingName:(NSString * _Nullable)buildingName extraInfo:(NSDictionary * _Nullable)info withRgcData:(BMKLocationReGeocode * _Nullable)rgc;
@end
#endif /* BMKLocation_h */

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2e680f909b1194595a58dc7b045eddcf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,56 @@
//
// BMKLocationAuth.h
// LocationComponent
//
// Created by baidu on 2017/4/10.
// Copyright © 2017年 baidu. All rights reserved.
//
#ifndef BMKLocationAuth_h
#define BMKLocationAuth_h
///定位鉴权错误码
typedef NS_ENUM(NSInteger, BMKLocationAuthErrorCode) {
BMKLocationAuthErrorUnknown = -1, ///< 未知错误
BMKLocationAuthErrorSuccess = 0, ///< 鉴权成功
BMKLocationAuthErrorNetworkFailed = 1, ///< 因网络鉴权失败
BMKLocationAuthErrorFailed = 2, ///< KEY非法鉴权失败
};
///通知Delegate
@protocol BMKLocationAuthDelegate <NSObject>
@optional
/**
*@brief 返回授权验证错误
*@param iError 错误号 : 为0时验证通过具体参加BMKLocationAuthErrorCode
*/
- (void)onCheckPermissionState:(BMKLocationAuthErrorCode)iError;
@end
///BMKLocationAuth类。用于鉴权
@interface BMKLocationAuth : NSObject
///鉴权状态0成功 1网络错误 2授权失败
@property(nonatomic, readonly, assign) BMKLocationAuthErrorCode permisionState;
/**
* @brief 得到BMKLocationAuth的单例
*/
+ (BMKLocationAuth*)sharedInstance;
/**
*@brief 启动引擎
*@param key 申请的有效key
*@param delegate 回调是否鉴权成功
*/
-(void)checkPermisionWithKey:(NSString*)key authDelegate:(id<BMKLocationAuthDelegate>)delegate;
@end
#endif /* BMKLocationAuth_h */

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7cd9a5eed3e7e448798679bedd2effbf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
//
// BMKLocationComponent.h
// LocationComponent
//
// Created by Baidu on 3/31/14.
// Copyright (c) 2014 baidu. All rights reserved.
//
#import "BMKLocationManager.h"
#import "BMKLocationKitVersion.h"
#import "BMKLocationPoi.h"
#import "BMKLocation.h"
#import "BMKGeoFenceRegion.h"
#import "BMKGeoFenceManager.h"
#import "BMKLocationReGeocode.h"
#import "BMKLocationAuth.h"

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 5831c77bd3ced4121be2c5cf4b9bd240
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,30 @@
//
// BMKLocationKitVersion.h
// BMKLocationKit
//
// Created by baidu on 17/9/9.
// Copyright © 2017年 baidu. All rights reserved.
//
#ifndef BMKLocationKitVersion_h
#define BMKLocationKitVersion_h
#import <UIKit/UIKit.h>
/**
*获取当前定位sdk 的版本号
*当前定位sdk版本 : 1.8.5
*@return 返回当前定位sdk 的版本号
*/
UIKIT_EXTERN NSString* BMKLocationKitVersion();
/**
*获取当前定位sdk 的float版本号
*当前定位sdk版本 : 1.85
*@return 返回当前定位sdk 的float版本号
*/
UIKIT_EXTERN float BMKLocationKitFloatVersion();
#endif /* BMKLocationKitVersion_h */

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 92f373756c24c43e6889ae47776863d2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,253 @@
//
// BMKLocationManager.h
// BMKLocationKit
//
// Created by baidu on 2017/3/2.
// Copyright © 2017年 baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "BMKLocationReGeocode.h"
#import "BMKLocation.h"
/** BMKLocationCoordinateType 枚举坐标系类型
*
*/
typedef NS_ENUM(NSUInteger, BMKLocationCoordinateType)
{
BMKLocationCoordinateTypeBMK09LL = 0, ///<BMK09LL
BMKLocationCoordinateTypeBMK09MC, ///<BMK09MC
BMKLocationCoordinateTypeWGS84, ///<WGS84
BMKLocationCoordinateTypeGCJ02 ///<GCJ02
};
/** BMKLocationNetworkState 枚举识别网络状态类型
*
*/
typedef NS_ENUM(int, BMKLocationNetworkState) {
BMKLocationNetworkStateUnknown = 0, ///<网络状态未知
BMKLocationNetworkStateWifi, ///<网络状态wifi
BMKLocationNetworkStateWifiHotSpot, ///<网络状态连接WIFI移动热点
BMKLocationNetworkStateMobile2G, ///<网络状态移动2G
BMKLocationNetworkStateMobile3G, ///<网络状态移动3G
BMKLocationNetworkStateMobile4G ///<网络状态移动4G
};
///BMKLocation errorDomain
FOUNDATION_EXPORT NSErrorDomain const _Nonnull BMKLocationErrorDomain;
///BMKLocation errorCode
typedef NS_ENUM(NSInteger, BMKLocationErrorCode)
{
BMKLocationErrorUnKnown = 0, ///<未知异常
BMKLocationErrorLocFailed = 1, ///<位置未知,持续定位中
BMKLocationErrorDenied = 2, ///<手机不允许定位,请确认用户授予定位权限或者手机是否打开定位开关
BMKLocationErrorNetWork = 3, ///<因为网络原因导致系统定位失败
BMKLocationErrorHeadingFailed = 4, ///<获取手机方向信息失败
BMKLocationErrorGetExtraNetworkFailed = 5, ///<网络原因导致获取额外信息(地址、网络状态等信息)失败
BMKLocationErrorGetExtraParseFailed = 6, ///<网络返回数据解析失败导致获取额外信息(地址、网络状态等信息)失败
BMKLocationErrorFailureAuth = 7, ///<鉴权失败导致无法返回定位、地址等信息
};
/**
* @brief 单次定位返回Block
* @param location 定位信息数据包括CLLocation 位置数据BMKLocationReGeocode 地址信息参考BMKLocation。
* @param state 移动热点状态
* @param error 错误信息,参考 BMKLocationErrorCode
*/
typedef void (^BMKLocatingCompletionBlock)(BMKLocation * _Nullable location, BMKLocationNetworkState state , NSError * _Nullable error);
@protocol BMKLocationManagerDelegate;
#pragma mark - BMKLocationManager
///BMKLocationManager类。初始化之前请设置 BMKLocationAuth 中的APIKey否则将无法正常使用服务.
@interface BMKLocationManager : NSObject
///实现了 BMKLocationManagerDelegate 协议的类指针。
@property (nonatomic, weak, nullable) id<BMKLocationManagerDelegate> delegate;
///设定定位的最小更新距离。默认为 kCLDistanceFilterNone。
@property(nonatomic, assign) CLLocationDistance distanceFilter;
///设定定位精度。默认为 kCLLocationAccuracyBest。
@property(nonatomic, assign) CLLocationAccuracy desiredAccuracy;
///设定定位类型。默认为 CLActivityTypeAutomotiveNavigation。
@property(nonatomic, assign) CLActivityType activityType;
///设定定位坐标系类型。默认为 BMKLocationCoordinateTypeGCJ02。
@property(nonatomic, assign) BMKLocationCoordinateType coordinateType;
///指定定位是否会被系统自动暂停。默认为NO。
@property(nonatomic, assign) BOOL pausesLocationUpdatesAutomatically;
///是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态否则会抛出异常。由于iOS系统限制需要在定位未开始之前或定位停止之后修改该属性的值才会有效果。
@property(nonatomic, assign) BOOL allowsBackgroundLocationUpdates;
///指定单次定位超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。注意: 单次定位超时时间从确定了定位权限(非kCLAuthorizationStatusNotDetermined状态)后开始计算。
@property(nonatomic, assign) NSInteger locationTimeout;
///指定单次定位逆地理超时时间,默认为10s。最小值是2s。注意单次定位请求前设置。
@property(nonatomic, assign) NSInteger reGeocodeTimeout;
///连续定位是否返回逆地理信息默认YES。
@property (nonatomic, assign) BOOL locatingWithReGeocode;
///定位sdk-v1.3之后开发者可以选择是否需要最新版本rgc数据默认是不需要NOYES的情况下定位sdk会实时返回最新的rgc数据如城市变更等数据都会实时更新
@property (nonatomic, assign) BOOL isNeedNewVersionReGeocode;
///开发者可以指定该用户的id用于后续统一识别用户便于查找问题
@property(nonatomic, copy, nullable) NSString * userID;
/**
* @brief 单次定位。如果当前正在连续定位调用此方法将会失败返回NO。\n该方法将会根据设定的 desiredAccuracy 去获取定位信息。如果获取的定位信息精确度低于 desiredAccuracy 将会持续的等待定位信息直到超时后通过completionBlock返回精度最高的定位信息。\n可以通过 stopUpdatingLocation 方法去取消正在进行的单次定位请求。
* @param withReGeocode 是否带有逆地理信息(获取逆地理信息需要联网)
* @param withNetWorkState 是否带有移动热点识别状态(需要联网)
* @param completionBlock 单次定位完成后的Block
* @return 是否成功添加单次定位Request
*/
- (BOOL)requestLocationWithReGeocode:(BOOL)withReGeocode withNetworkState:(BOOL)withNetWorkState completionBlock:(BMKLocatingCompletionBlock _Nonnull)completionBlock;
/**
* @brief 开始连续定位。调用此方法会cancel掉所有的单次定位请求。
*/
- (void)startUpdatingLocation;
/**
* @brief 停止连续定位。调用此方法会cancel掉所有的单次定位请求可以用来取消单次定位。
*/
- (void)stopUpdatingLocation;
/**
* @brief 请求网络状态结果回调。
*/
- (void)requestNetworkState;
/**
* @brief 该方法返回设备是否支持设备朝向事件回调。
* @return 是否支持设备朝向事件回调
*/
+ (BOOL)headingAvailable;
/**
* @brief 该方法为BMKLocationManager开始设备朝向事件回调。
*/
- (void)startUpdatingHeading;
/**
* @brief 该方法为BMKLocationManager停止设备朝向事件回调。
*/
- (void)stopUpdatingHeading;
/**
* @brief 该方法为BMKLocationManager尝试使用高精度室内定位。在特定的室内场景下会有更高精度的定位回调只在室内定位版本生效。
*/
- (void)tryIndoorLocation;
/**
* @brief 该方法为BMKLocationManager会关闭高精度室内定位只在室内定位版本生效。
*/
- (void)stopIndoorLocation;
/**
* @brief 转换为百度经纬度的坐标
* @param coordinate 待转换的经纬度
* @param srctype 待转换坐标系类型
* @param destype 目标百度坐标系类型bd09ll,bd09mc
* @return 目标百度坐标系经纬度
*/
+ (CLLocationCoordinate2D) BMKLocationCoordinateConvert:(CLLocationCoordinate2D) coordinate SrcType:(BMKLocationCoordinateType)srctype DesType:(BMKLocationCoordinateType)destype;
/**
* @brief 判断目标经纬度是否在大陆以及港、澳地区。
* @param coordinate 待判断的目标经纬度
* @param coortype 待判断经纬度的坐标系类型
* @return 是否在大陆以及港、澳地区
*/
+ (BOOL) BMKLocationDataAvailableForCoordinate:(CLLocationCoordinate2D)coordinate withCoorType:(BMKLocationCoordinateType)coortype;
@end
#pragma mark - BMKLocationManagerDelegate
///BMKLocationManagerDelegate 协议定义了发生错误时的错误回调方法,连续定位的回调方法等。
@protocol BMKLocationManagerDelegate <NSObject>
@optional
/**
* @brief 为了适配app store关于新的后台定位的审核机制app store要求如果开发者只配置了使用期间定位则代码中不能出现申请后台定位的逻辑当开发者在plist配置NSLocationAlwaysUsageDescription或者NSLocationAlwaysAndWhenInUseUsageDescription时需要在该delegate中调用后台定位api[locationManager requestAlwaysAuthorization]。开发者如果只配置了NSLocationWhenInUseUsageDescription且只有使用期间的定位需求则无需在delegate中实现逻辑。
* @param manager 定位 BMKLocationManager 类。
* @param locationManager 系统 CLLocationManager 类 。
* @since 1.6.0
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager;
/**
* @brief 当定位发生错误时,会调用代理的此方法。
* @param manager 定位 BMKLocationManager 类。
* @param error 返回的错误,参考 CLError 。
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didFailWithError:(NSError * _Nullable)error;
/**
* @brief 连续定位回调函数。
* @param manager 定位 BMKLocationManager 类。
* @param location 定位结果参考BMKLocation。
* @param error 错误信息。
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didUpdateLocation:(BMKLocation * _Nullable)location orError:(NSError * _Nullable)error;
/**
* @brief 定位权限状态改变时回调函数
* @param manager 定位 BMKLocationManager 类。
* @param status 定位权限状态。
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
/**
* @brief 该方法为BMKLocationManager提示需要设备校正回调方法。
* @param manager 提供该定位结果的BMKLocationManager类的实例。
*/
- (BOOL)BMKLocationManagerShouldDisplayHeadingCalibration:(BMKLocationManager * _Nonnull)manager;
/**
* @brief 该方法为BMKLocationManager提供设备朝向的回调方法。
* @param manager 提供该定位结果的BMKLocationManager类的实例
* @param heading 设备的朝向结果
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager
didUpdateHeading:(CLHeading * _Nullable)heading;
/**
* @brief 该方法为BMKLocationManager所在App系统网络状态改变的回调事件。
* @param manager 提供该定位结果的BMKLocationManager类的实例
* @param state 当前网络状态
* @param error 错误信息
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager
didUpdateNetworkState:(BMKLocationNetworkState)state orError:(NSError * _Nullable)error;
@end

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7fae39847c7a749778f509bb816c7e00
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,42 @@
//
// BMKLocationPoi.h
// BMKLocationKit
//
// Created by baidu on 2017/3/2.
// Copyright © 2017年 baidu. All rights reserved.
//
///描述Poi各属性
@interface BMKLocationPoi : NSObject
///BMKLocationPoi的id属性
@property(nonatomic, copy, readonly) NSString *uid;
///BMKLocationPoi的名字属性
@property(nonatomic, copy, readonly) NSString *name;
///BMKLocationPoi的标签属性
@property(nonatomic, copy, readonly) NSString *tags;
///BMKLocationPoi的地址属性
@property(nonatomic, copy, readonly) NSString *addr;
///BMKLocationPoi的可信度
@property(nonatomic, assign, readonly) float relaiability;
/**
* @brief 通过NSDictionary初始化方法一
*/
- (id)initWithDictionary:(NSDictionary *)dictionary;
/**
* @brief 通过NSDictionary初始化方法二
*/
- (id)initWithTwoDictionary:(NSDictionary *)dictionary;
@end

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9457a1538d29e4c62994c1431e3d459c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
//
// BMKLocationPoiRegion.h
// LocationComponent
//
// Created by Jiang,Fangsheng on 2019/9/4.
// Copyright © 2019 baidu. All rights reserved.
//
#ifndef BMKLocationPoiRegion_h
#define BMKLocationPoiRegion_h
///描述PoiRegion各属性
@interface BMKLocationPoiRegion : NSObject
///BMKLocationPoiRegion的方向属性如『内』、『外』
@property(nonatomic, copy, readonly) NSString *directionDesc;
///BMKLocationPoiRegion的名字属性
@property(nonatomic, copy, readonly) NSString *name;
///BMKLocationPoiRegion的标签属性
@property(nonatomic, copy, readonly) NSString *tags;
/**
* @brief 通过NSDictionary初始化方法一
*/
- (id)initWithDictionary:(NSDictionary *)dictionary;
@end
#endif /* BMKLocationPoiRegion_h */

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: b52b473fb55a44120b600e020b8f3f09
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,67 @@
//
// BMKLocationReGeocode.h
// BMKLocationKit
//
// Created by baidu on 2017/3/2.
// Copyright © 2017年 baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BMKLocationPoi.h"
#import "BMKLocationPoiRegion.h"
///BMKLocationReGeocode类。描述跟地址有关的信息.
@interface BMKLocationReGeocode : NSObject
///国家名字属性
@property(nonatomic, copy, readonly) NSString *country;
///国家编码属性
@property(nonatomic, copy, readonly) NSString *countryCode;
///省份名字属性
@property(nonatomic, copy, readonly) NSString *province;
///城市名字属性
@property(nonatomic, copy, readonly) NSString *city;
///区名字属性
@property(nonatomic, copy, readonly) NSString *district;
///乡镇名字属性
@property(nonatomic, copy, readonly) NSString *town;
///街道名字属性
@property(nonatomic, copy, readonly) NSString *street;
///街道号码属性
@property(nonatomic, copy, readonly) NSString *streetNumber;
///城市编码属性
@property(nonatomic, copy, readonly) NSString *cityCode;
///行政区划编码属性
@property(nonatomic, copy, readonly) NSString *adCode;
///位置语义化结果的定位点在什么地方周围的描述信息
@property(nonatomic, copy, readonly) NSString *locationDescribe;
///位置语义化结果的属性该定位点周围的poi列表信息
@property(nonatomic, retain, readonly) NSArray<BMKLocationPoi *> *poiList;
///位置语义化结果的定位点在什么地方周围的描述信息
@property(nonatomic, strong, readonly) BMKLocationPoiRegion *poiRegion;
/**
* @brief 通过NSData初始化方法
*/
- (id)initWithReGeocodeString:(NSData *)reGeocodeString;
/**
* @brief 通过JSON初始化方法
*/
- (id)initWithJsonString:(NSData *)jsonString withHighAccuracy:(BOOL)highAcc;
@end

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f92677fb7cc3a41da8e8555fc61d3449
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,11 @@
1、版本
百度地图iOS定位SDK v1.8
2、是否带IDFA
3、是否为Bitcode
4、集成方法
http://lbsyun.baidu.com/index.php?title=ios-locsdk

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ae59b7aebc96043e09ca007b8de2fb3c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,13 @@
#ifndef SingleLocPlugin_h
#define SingleLocPlugin_h
#import <BMKLocationkit/BMKLocationAuth.h>
#import <BMKLocationkit/BMKLocationComponent.h>
@interface SingleLocPlugin : NSObject
NSString *unityListner;
@end
@property(nonatomic, strong) BMKLocationManager *locationManager;
@property(nonatomic, copy) BMKLocatingCompletionBlock completionBlock;
#endif

View File

@@ -0,0 +1,27 @@
fileFormatVersion: 2
guid: c88aba58aed734afa9646264f6dc2c12
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,154 @@
//
// SingleLocDemoViewController.m
// IphoneMapSdkDemo
//
// Created by baidu on 2017/4/5.
// Copyright © 2017 Baidu. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "SingleLocPlugin.h"
static SingleLocPlugin* _singleLocPlugin;
@implementation SingleLocPlugin
+(SingleLocPlugin*) instance
{
if (_singleLocPlugin != nil) {
return _singleLocPlugin;
} else {
_singleLocPlugin =(SingleLocPlugin*)([[SingleLocPlugin alloc] init]);
}
return _singleLocPlugin;
}
- (id)init:(NSString *)ak withUnityListner:(NSString *)listner andCoorType:(int)coordinateType
{
unityListner = listner;
[[BMKLocationAuth sharedInstance] checkPermisionWithKey:ak authDelegate:self];
[self initLocation:coordinateType];
return self;
}
-(void)initLocation:(int)coordinateType
{
_locationManager = [[BMKLocationManager alloc] init];
_locationManager.delegate = self;
if(coordinateType == 0) {
_locationManager.coordinateType = BMKLocationCoordinateTypeBMK09LL;
} else if(coordinateType == 1) {
_locationManager.coordinateType = BMKLocationCoordinateTypeBMK09MC;
} else if(coordinateType == 2) {
_locationManager.coordinateType = BMKLocationCoordinateTypeWGS84;
} else {
_locationManager.coordinateType = BMKLocationCoordinateTypeGCJ02;
}
_locationManager.coordinateType = BMKLocationCoordinateTypeBMK09LL; //BMKLocationCoordinateTypeGCJ02
_locationManager.distanceFilter = [distance.text doubleValue];
_locationManager.desiredAccuracy = kCLLocationAccuracyBest;
_locationManager.activityType = CLActivityTypeAutomotiveNavigation;
_locationManager.pausesLocationUpdatesAutomatically = NO;
_locationManager.allowsBackgroundLocationUpdates = NO;// YES
_locationManager.locationTimeout = 10;
_locationManager.reGeocodeTimeout = 10;
}
-(void)getMyLocation
{
self.completionBlock = ^(BMKLocation *location, BMKLocationNetworkState state, NSError *error)
{
long code = 0
NSString *msg = nil;
float latitude = 0;
float longitude = 0;
NSString *AddrStr = @"";
if (error)
{
code = (long)error.code;
msg = error.localizedDescription;
NSLog(@"locError:{%ld - %@};", (long)error.code, error.localizedDescription);
}
if (location.location) {//annotation
NSLog(@"LOC = %@",location.location);
NSLog(@"LOC ID= %@",location.locationID);
latitude = location.location.coordinate.latitude;
longitude = location.location.coordinate.longitude;
if(location.rgcData) {
AddrStr = [location.rgcData description];
}
NSLog([NSString stringWithFormat:@"当前位置信息: \n经纬度%.6f,%.6f \n地址信息%@ \n网络状态%d",location.location.coordinate.latitude, location.location.coordinate.longitude, AddrStr, state]);
}
NSLog(@"netstate = %d",state);
NSString * json = [NSString stringWithFormat:@"{\"cmd\":\"onGetLocation\", \"code\":%ld,\"msg\":\"%@\",\"latitude\":%0.6f,\"longitude\":%0.6f,\"AddrStr\":\"%@\"}",code, msg, latitude, longitude, AddrStr];
[self sendUnityMessage:@"onCallback", json]
};
}
-(void) sendUnityMessage:(const NSString*)method with:(NSString*)msg
{
if(unityListner != nil && msg != nil) {
UnitySendMessage([unityListner UTF8String],
[method UTF8String], [msg UTF8String]);
}
}
- (void)onGetPermissionState:(int)iError
{
if (0 == iError) {
NSLog(@"授权成功");
}
else {
NSLog(@"onGetPermissionState %d",iError);
}
}
- (void)onCheckPermissionState:(BMKLocationAuthErrorCode)iError
{
NSLog(@"location auth onGetPermissionState %ld",(long)iError);
}
/**
* @brief app storeapp store使plistNSLocationAlwaysUsageDescriptionNSLocationAlwaysAndWhenInUseUsageDescriptiondelegateapi[locationManager requestAlwaysAuthorization]NSLocationWhenInUseUsageDescription使delegate
* @param manager BMKLocationManager
* @param locationManager CLLocationManager
* @since 1.6.0
*/
- (void)BMKLocationManager:(BMKLocationManager * _Nonnull)manager doRequestAlwaysAuthorization:(CLLocationManager * _Nonnull)locationManager
{
[locationManager requestAlwaysAuthorization];
}
- (void)dealloc {
_locationManager = nil;
_completionBlock = nil;
}
@end
#if __cplusplus
extern "C" {
#endif
void _init(const char* ak, const char* goName, const int coorType);
void _getMyLocation();
#if __cplusplus
}
#endif
void _init(const char* ak, const char* goName, const int coorType); {
[[SingleLocPlugin instance] init:[[NSString stringWithUTF8String:ak] withUnityListner:[NSString stringWithUTF8String:goName andCoorType:coorType] retain]];
}
void _getMyLocation() {
[[SingleLocPlugin instance] getMyLocation];
}

View File

@@ -0,0 +1,37 @@
fileFormatVersion: 2
guid: 74231996aa1884546a643eca962a10c1
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
iPhone: iOS
second:
enabled: 1
settings: {}
- first:
tvOS: tvOS
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant: