add
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -37,3 +37,5 @@ sysinfo.txt
|
||||
*.apk
|
||||
*.unitypackage
|
||||
|
||||
Logs
|
||||
UnityAPI
|
||||
|
||||
8
Assets/3rd.meta
Normal file
8
Assets/3rd.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dafdf2013e5c9403cb87a5093af7f06c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/3rd/Contacts.meta
Normal file
8
Assets/3rd/Contacts.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a8e3993ece1c4f44917fad1b23bb691
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
108
Assets/3rd/Contacts/Contact.cs
Executable file
108
Assets/3rd/Contacts/Contact.cs
Executable file
@@ -0,0 +1,108 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class PhoneContact
|
||||
{
|
||||
public string Number ;
|
||||
public string Type ;
|
||||
}
|
||||
|
||||
public class EmailContact
|
||||
{
|
||||
public string Address;
|
||||
public string Type ;
|
||||
}
|
||||
|
||||
|
||||
//holder of person details
|
||||
public class Contact
|
||||
{
|
||||
public string Id ;
|
||||
public string Name ;
|
||||
|
||||
public List<PhoneContact> Phones = new List<PhoneContact>();
|
||||
public List<EmailContact> Emails = new List<EmailContact>();
|
||||
|
||||
public List<string> Connections = new List<string>();//for android only. example(google,whatsup,...)
|
||||
|
||||
public Texture2D PhotoTexture ;
|
||||
|
||||
public void FromBytes( byte[] bytes )
|
||||
{
|
||||
|
||||
System.IO.BinaryReader reader = new System.IO.BinaryReader( new System.IO.MemoryStream( bytes ));
|
||||
|
||||
Id = readString( reader );
|
||||
Name = readString( reader );
|
||||
|
||||
short size = reader.ReadInt16();
|
||||
log( "Photo size == " + size );
|
||||
if( size > 0 )
|
||||
{
|
||||
byte[] photo = reader.ReadBytes( (int)size);
|
||||
PhotoTexture = new Texture2D(2,2);
|
||||
PhotoTexture.LoadImage( photo );
|
||||
}
|
||||
|
||||
size = reader.ReadInt16();
|
||||
log( "Phones size == " + size );
|
||||
if( size > 0 )
|
||||
{
|
||||
for( int i = 0 ; i < size ; i++ )
|
||||
{
|
||||
PhoneContact pc = new PhoneContact();
|
||||
pc.Number = readString( reader );
|
||||
pc.Type = readString( reader );
|
||||
Phones.Add( pc );
|
||||
}
|
||||
}
|
||||
|
||||
size = reader.ReadInt16();
|
||||
log( "Emails size == " + size );
|
||||
if( size > 0 )
|
||||
{
|
||||
for( int i = 0 ; i < size ; i++ )
|
||||
{
|
||||
EmailContact ec = new EmailContact();
|
||||
ec.Address = readString( reader );
|
||||
ec.Type = readString( reader );
|
||||
Emails.Add( ec );
|
||||
}
|
||||
}
|
||||
|
||||
size = reader.ReadInt16();
|
||||
log( "Connections size == " + size );
|
||||
if( size > 0 )
|
||||
{
|
||||
for( int i = 0 ; i < size ; i++ )
|
||||
{
|
||||
string connection = readString( reader );
|
||||
Connections.Add( connection );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
string readString( System.IO.BinaryReader reader )
|
||||
{
|
||||
string res = "";
|
||||
short size = reader.ReadInt16();
|
||||
log( "read string of size " + size );
|
||||
if( size == 0 )
|
||||
return res;
|
||||
|
||||
byte[] data = reader.ReadBytes( size);
|
||||
res = System.Text.Encoding.UTF8.GetString( data );
|
||||
|
||||
log( "string " + res + " is " + res);
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
void log( string message )
|
||||
{
|
||||
//Debug.Log( message );
|
||||
}
|
||||
}
|
||||
12
Assets/3rd/Contacts/Contact.cs.meta
Executable file
12
Assets/3rd/Contacts/Contact.cs.meta
Executable file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: efbcdd631fdecbd41a1105a215b099e2
|
||||
timeCreated: 1452248160
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
109
Assets/3rd/Contacts/Contacts.cs
Executable file
109
Assets/3rd/Contacts/Contacts.cs
Executable file
@@ -0,0 +1,109 @@
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
|
||||
|
||||
|
||||
//holder for all contacts information of your mobile
|
||||
//use this class to acces all mobile contacts information
|
||||
//this is the core of this asset, you have to know only how this class work
|
||||
// first call LoadContactList();
|
||||
// then loop throught all of ContactsList and acces data you like name name phones
|
||||
// Contact c = Contacts.ContactsList[i];
|
||||
// that is it, so easy, have fun
|
||||
public class Contacts{
|
||||
|
||||
//looks likee these four fields down doesnot working for all mobiles
|
||||
public static String MyPhoneNumber ;
|
||||
public static String SimSerialNumber ;
|
||||
public static String NetworkOperator ;
|
||||
public static String NetworkCountryIso ;
|
||||
//
|
||||
public static List<Contact> ContactsList = new List<Contact>();
|
||||
|
||||
|
||||
#if UNITY_ANDROID
|
||||
static AndroidJavaObject activity;
|
||||
static AndroidJavaClass ojc = null ;
|
||||
#elif UNITY_IOS
|
||||
[DllImport("__Internal")]
|
||||
private static extern void loadIOSContacts();
|
||||
[DllImport("__Internal")]
|
||||
private static extern string getContact( int index );
|
||||
#endif
|
||||
|
||||
|
||||
static System.Action<string> onFailed;
|
||||
static System.Action onDone;
|
||||
public static void LoadContactList( )
|
||||
{
|
||||
LoadContactList( null , null);
|
||||
}
|
||||
|
||||
public static void LoadContactList( System.Action _onDone, System.Action<string> _onFailed )
|
||||
{
|
||||
Debug.Log ( "LoadContactList at " + Time.realtimeSinceStartup );
|
||||
onFailed = _onFailed;
|
||||
onDone = _onDone;
|
||||
|
||||
GameObject helper = new GameObject ();
|
||||
GameObject.DontDestroyOnLoad( helper);
|
||||
helper.name = "ContactsListMessageReceiver";
|
||||
helper.AddComponent<MssageReceiver> ();
|
||||
|
||||
#if UNITY_ANDROID
|
||||
ojc = new AndroidJavaClass("com.aliessmael.contactslist.ContactList");
|
||||
AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
|
||||
activity = jc.GetStatic<AndroidJavaObject>("currentActivity");
|
||||
ojc.CallStatic("LoadInformation" , activity , true, true,true,true);
|
||||
#elif UNITY_IOS
|
||||
loadIOSContacts();
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void GetContact( int index )
|
||||
{
|
||||
byte[] data = null;
|
||||
|
||||
#if UNITY_ANDROID
|
||||
data = ojc.CallStatic<byte[]>("getContact" , index);
|
||||
#elif UNITY_IOS
|
||||
string str = getContact( index);
|
||||
data = System.Convert.FromBase64String( str );
|
||||
#endif
|
||||
Contact c = new Contact();
|
||||
debug( "Data length for " + index + " is " + data.Length );
|
||||
c.FromBytes( data );
|
||||
Contacts.ContactsList.Add( c );
|
||||
|
||||
}
|
||||
|
||||
public static void OnInitializeDone()
|
||||
{
|
||||
Debug.Log ( "done at " + Time.realtimeSinceStartup );
|
||||
if (onDone != null)
|
||||
{
|
||||
onDone();
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnInitializeFail( string message )
|
||||
{
|
||||
Debug.Log ( "fail at " + Time.realtimeSinceStartup );
|
||||
if (onFailed != null)
|
||||
{
|
||||
onFailed( message );
|
||||
}
|
||||
}
|
||||
|
||||
static void debug( string message)
|
||||
{
|
||||
//Debug.Log ( message );
|
||||
}
|
||||
|
||||
}
|
||||
8
Assets/3rd/Contacts/Contacts.cs.meta
Executable file
8
Assets/3rd/Contacts/Contacts.cs.meta
Executable file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2933fffb2c43e7247a0ab16722abe1e0
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
262
Assets/3rd/Contacts/ContactsListGUI.cs
Executable file
262
Assets/3rd/Contacts/ContactsListGUI.cs
Executable file
@@ -0,0 +1,262 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
//this is test class, it use Contacts class to access your mobile contacts and draw it on screen
|
||||
//it is just viewer , you may create your own GUI for that
|
||||
public class ContactsListGUI : MonoBehaviour {
|
||||
|
||||
public Font font ;
|
||||
public Texture2D even_contactTexture;
|
||||
public Texture2D odd_contactTexture;
|
||||
public Texture2D contact_faceTexture;
|
||||
GUIStyle style ;
|
||||
GUIStyle evenContactStyle ;
|
||||
GUIStyle oddContactStyle ;
|
||||
GUIStyle contactFaceStyle ;
|
||||
GUIStyle nonStyle2 ;
|
||||
Vector2 size ;
|
||||
float dragTime ;
|
||||
float dragSpeed ;
|
||||
|
||||
string failString;
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
Contacts.LoadContactList( onDone, onLoadFailed );
|
||||
|
||||
|
||||
|
||||
|
||||
style = new GUIStyle();
|
||||
style.font = font ;
|
||||
style.fontSize = (int)(size.y / 2) ;
|
||||
|
||||
|
||||
size.x = Screen.width ;
|
||||
size.y = Screen.height / 6 ;
|
||||
|
||||
evenContactStyle = new GUIStyle();
|
||||
evenContactStyle.normal.background = even_contactTexture ;
|
||||
//evenContactStyle.fixedWidth= size.x ;
|
||||
evenContactStyle.fixedHeight = size.y ;
|
||||
evenContactStyle.clipping = TextClipping.Clip ;
|
||||
evenContactStyle.alignment = TextAnchor.UpperLeft ;
|
||||
evenContactStyle.imagePosition = ImagePosition.ImageLeft ;
|
||||
evenContactStyle.fontSize = (int)(size.y /2 );
|
||||
//evenLogStyle.wordWrap = true;
|
||||
|
||||
oddContactStyle = new GUIStyle();
|
||||
oddContactStyle.normal.background = odd_contactTexture;
|
||||
//oddContactStyle.fixedWidth= size.x ;
|
||||
oddContactStyle.fixedHeight = size.y ;
|
||||
oddContactStyle.clipping = TextClipping.Clip ;
|
||||
oddContactStyle.alignment = TextAnchor.UpperLeft ;
|
||||
oddContactStyle.imagePosition = ImagePosition.ImageLeft ;
|
||||
oddContactStyle.fontSize = (int)(size.y /2 );
|
||||
|
||||
contactFaceStyle = new GUIStyle();
|
||||
contactFaceStyle.fixedHeight = size.y ;
|
||||
contactFaceStyle.fixedWidth = size.y ;
|
||||
//contactFaceStyle.normal.background = contact_faceTexture;
|
||||
|
||||
nonStyle2 = new GUIStyle();
|
||||
nonStyle2.clipping = TextClipping.Clip;
|
||||
nonStyle2.border = new RectOffset(0,0,0,0);
|
||||
nonStyle2.normal.background = null ;
|
||||
nonStyle2.fontSize = 1;
|
||||
nonStyle2.alignment = TextAnchor.MiddleCenter ;
|
||||
}
|
||||
|
||||
|
||||
Vector2 downPos ;
|
||||
Vector2 getDownPos()
|
||||
{
|
||||
if( Application.platform == RuntimePlatform.Android ||
|
||||
Application.platform == RuntimePlatform.IPhonePlayer )
|
||||
{
|
||||
|
||||
if( Input.touches.Length == 1 && Input.touches[0].phase == TouchPhase.Began )
|
||||
{
|
||||
dragSpeed = 0;
|
||||
downPos = Input.touches[0].position ;
|
||||
return downPos ;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Input.GetMouseButtonDown(0) )
|
||||
{
|
||||
dragSpeed = 0;
|
||||
downPos.x = Input.mousePosition.x ;
|
||||
downPos.y = Input.mousePosition.y ;
|
||||
return downPos ;
|
||||
}
|
||||
}
|
||||
|
||||
return Vector2.zero ;
|
||||
}
|
||||
Vector2 mousePosition ;
|
||||
Vector2 getDrag()
|
||||
{
|
||||
|
||||
if( Application.platform == RuntimePlatform.Android ||
|
||||
Application.platform == RuntimePlatform.IPhonePlayer )
|
||||
{
|
||||
if( Input.touches.Length != 1 )
|
||||
{
|
||||
return Vector2.zero ;
|
||||
}
|
||||
return Input.touches[0].position - downPos ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Input.GetMouseButton(0) )
|
||||
{
|
||||
mousePosition = Input.mousePosition ;
|
||||
return mousePosition - downPos ;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Vector2.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int calculateStartIndex()
|
||||
{
|
||||
int totalCout = Contacts.ContactsList.Count ;
|
||||
int totalVisibleCount = 6 ;
|
||||
int startIndex = (int)(contactsScrollPos.y /size.y) ;
|
||||
if( startIndex < 0 ) startIndex = 0 ;
|
||||
|
||||
if( totalCout < totalVisibleCount ) startIndex = 0 ;
|
||||
else if( startIndex > totalCout - totalVisibleCount )
|
||||
startIndex = totalCout - totalVisibleCount ;
|
||||
|
||||
return startIndex ;
|
||||
}
|
||||
Vector2 contactsScrollPos ;
|
||||
|
||||
Vector2 oldContactsDrag ;
|
||||
void OnGUI()
|
||||
{
|
||||
if (!string.IsNullOrEmpty (failString))
|
||||
{
|
||||
GUILayout.Label( "failed : " + failString );
|
||||
if( GUILayout.Button("Retry"))
|
||||
{
|
||||
Contacts.LoadContactList( onDone, onLoadFailed );
|
||||
failString = null;
|
||||
}
|
||||
}
|
||||
//return;
|
||||
getDownPos();
|
||||
|
||||
Vector2 drag = getDrag();
|
||||
if( (drag.x != 0) && (downPos != Vector2.zero) )
|
||||
{
|
||||
//contactsScrollPos.x -= (drag.x - oldContactsDrag.x) ;
|
||||
}
|
||||
if( (drag.y != 0) && (downPos != Vector2.zero) )
|
||||
{
|
||||
contactsScrollPos.y += (drag.y - oldContactsDrag.y) ;
|
||||
dragTime += Time.deltaTime ;
|
||||
//dragSpeed = drag.y / dragTime ;
|
||||
}
|
||||
|
||||
|
||||
else if( dragSpeed > 1f){
|
||||
dragTime = 0 ;
|
||||
contactsScrollPos.y += dragSpeed * Time.deltaTime ;
|
||||
dragSpeed -= (dragSpeed*0.01f);
|
||||
}
|
||||
oldContactsDrag = drag;
|
||||
|
||||
//GUILayout.Label("My Phone Number = " + Contacts.MyPhoneNumber );
|
||||
/*GUILayout.Label("simSerialNumber " + Contacts.SimSerialNumber );
|
||||
GUILayout.Label("networkOperator " + Contacts.NetworkOperator );
|
||||
GUILayout.Label("networkCountryIso " + Contacts.NetworkCountryIso );
|
||||
GUILayout.Label("Contacts Count are " + Contacts.ContactsList.Count );*/
|
||||
contactsScrollPos = GUILayout.BeginScrollView( contactsScrollPos );
|
||||
|
||||
int startIndex = calculateStartIndex();
|
||||
int endIndex = startIndex + 7 ;
|
||||
if( endIndex > Contacts.ContactsList.Count )
|
||||
endIndex = Contacts.ContactsList.Count ;
|
||||
|
||||
int beforeHeight = (int)(startIndex*size.y) ;
|
||||
if( beforeHeight > 0 )
|
||||
{
|
||||
//fill invisible gap befor scroller to make proper scroller pos
|
||||
GUILayout.BeginHorizontal( GUILayout.Width(size.x*2) , GUILayout.Height( beforeHeight ) );
|
||||
GUILayout.Box(" " ,nonStyle2 );
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.BeginHorizontal( GUILayout.Width(size.x*2) , GUILayout.Height( 1f ) );
|
||||
GUILayout.Box(" " , nonStyle2 );
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
for( int i = startIndex ; i < endIndex ; i++ )
|
||||
{
|
||||
if( i%2 == 0 )
|
||||
GUILayout.BeginHorizontal( evenContactStyle ,GUILayout.Width( size.x) , GUILayout.Height( size.y ));
|
||||
else
|
||||
GUILayout.BeginHorizontal( oddContactStyle ,GUILayout.Width( size.x) , GUILayout.Height( size.y ));
|
||||
GUILayout.Label( i.ToString() , style );
|
||||
Contact c = Contacts.ContactsList[i];
|
||||
|
||||
if( c.PhotoTexture != null )
|
||||
{
|
||||
GUILayout.Box( new GUIContent(c.PhotoTexture) , GUILayout.Width(size.y), GUILayout.Height(size.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.Box( new GUIContent(contactFaceStyle.normal.background) , GUILayout.Width(size.y), GUILayout.Height(size.y));
|
||||
}
|
||||
|
||||
string text = "Native Id : " + c.Id + "\n";
|
||||
text += "Name : " + c.Name + "\n";
|
||||
for(int p = 0 ; p < c.Phones.Count ; p++)
|
||||
{
|
||||
text += "Number : " + c.Phones[p].Number + " , Type " + c.Phones[p].Type + " \n";
|
||||
}
|
||||
for(int e = 0 ; e < c.Emails.Count ; e++)
|
||||
text += "Email : " + c.Emails[e].Address + " : Type " + c.Emails[e].Type + "\n";
|
||||
for(int e = 0 ; e < c.Connections.Count ; e++)
|
||||
text += "Connection : " + c.Connections[e] + "\n";
|
||||
text += "------------------";
|
||||
GUILayout.Label( text , style , GUILayout.Width(size.x - size.y - 40 ) );
|
||||
GUILayout.Space(50);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
int afterHeight = (int)((Contacts.ContactsList.Count - ( startIndex + 6 ))*size.y) ;
|
||||
if( afterHeight > 0 )
|
||||
{
|
||||
//fill invisible gap after scroller to make proper scroller pos
|
||||
GUILayout.BeginHorizontal( GUILayout.Width(size.x*2) , GUILayout.Height(afterHeight ) );
|
||||
GUILayout.Box(" ",nonStyle2);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
else
|
||||
{
|
||||
GUILayout.BeginHorizontal( GUILayout.Width(size.x*2) , GUILayout.Height(1f) );
|
||||
GUILayout.Box(" ",nonStyle2);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
}
|
||||
|
||||
|
||||
void onLoadFailed( string reason )
|
||||
{
|
||||
failString = reason;
|
||||
}
|
||||
|
||||
void onDone()
|
||||
{
|
||||
failString = null;
|
||||
}
|
||||
}
|
||||
8
Assets/3rd/Contacts/ContactsListGUI.cs.meta
Executable file
8
Assets/3rd/Contacts/ContactsListGUI.cs.meta
Executable file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 596da6aa7e8936543a9c85c2c325edbc
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 50
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
8
Assets/3rd/Contacts/ContactsLoader.cs
Executable file
8
Assets/3rd/Contacts/ContactsLoader.cs
Executable file
@@ -0,0 +1,8 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ContactsLoader {
|
||||
|
||||
public List<Contact> ToLoad = new List<Contact>();
|
||||
}
|
||||
8
Assets/3rd/Contacts/ContactsLoader.cs.meta
Executable file
8
Assets/3rd/Contacts/ContactsLoader.cs.meta
Executable file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22461e2f9d28ed645b8809d355f5e8d0
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
4
Assets/3rd/Contacts/Documentation.meta
Executable file
4
Assets/3rd/Contacts/Documentation.meta
Executable file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f5a7190285e58249b41c394efaf7a77
|
||||
DefaultImporter:
|
||||
userData:
|
||||
BIN
Assets/3rd/Contacts/Documentation/icon_precise.png
Executable file
BIN
Assets/3rd/Contacts/Documentation/icon_precise.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
35
Assets/3rd/Contacts/Documentation/icon_precise.png.meta
Executable file
35
Assets/3rd/Contacts/Documentation/icon_precise.png.meta
Executable file
@@ -0,0 +1,35 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f3c2b3d580b95245a2ef98596938fb3
|
||||
TextureImporter:
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
userData:
|
||||
BIN
Assets/3rd/Contacts/Documentation/icon_smile.gif
Executable file
BIN
Assets/3rd/Contacts/Documentation/icon_smile.gif
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 174 B |
35
Assets/3rd/Contacts/Documentation/icon_smile.gif.meta
Executable file
35
Assets/3rd/Contacts/Documentation/icon_smile.gif.meta
Executable file
@@ -0,0 +1,35 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d0759e09dd78de44958df316736cd99
|
||||
TextureImporter:
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
userData:
|
||||
102
Assets/3rd/Contacts/Documentation/index.htm
Executable file
102
Assets/3rd/Contacts/Documentation/index.htm
Executable file
@@ -0,0 +1,102 @@
|
||||
<!DOCTYPE html>
|
||||
<!--[if IE 6]>
|
||||
<html id="ie6" lang="en-US">
|
||||
<![endif]-->
|
||||
<!--[if IE 7]>
|
||||
<html id="ie7" lang="en-US">
|
||||
<![endif]-->
|
||||
<!--[if IE 8]>
|
||||
<html id="ie8" lang="en-US">
|
||||
<![endif]-->
|
||||
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!-->
|
||||
<html lang="en-US">
|
||||
<!--<![endif]-->
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<title>Contacts List | </title>
|
||||
<link rel="profile" href="../../../gmpg.org/xfn/11/index.htm" />
|
||||
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
|
||||
<link rel="pingback" href="../../xmlrpc.php.htm" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="../../wp-content/themes/twentyeleven/js/html5.js" type="text/javascript"></script>
|
||||
<![endif]-->
|
||||
<link rel="alternate" type="application/rss+xml" title=" » Feed" href="../../feed/index.htm" />
|
||||
<link rel="alternate" type="application/rss+xml" title=" » Comments Feed" href="../../comments/feed/index.htm" />
|
||||
<link rel="alternate" type="application/rss+xml" title=" » Contacts List Comments Feed" href="feed/index.htm" />
|
||||
<script type='text/javascript' src='../../wp-includes/js/comment-reply.min.js-ver=3.8.4.htm'></script>
|
||||
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="../../xmlrpc.php-rsd.htm" />
|
||||
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="../../wp-includes/wlwmanifest.xml.htm" />
|
||||
<link rel='prev' title='Products' href='../index.htm' />
|
||||
<link rel='canonical' href='index.htm' />
|
||||
<link rel='shortlink' href='../../-p=88.htm' />
|
||||
</head>
|
||||
|
||||
<body class="page page-id-88 page-child parent-pageid-52 page-template-default single-author singular two-column right-sidebar">
|
||||
<div id="page" class="hfeed">
|
||||
<header id="branding" role="banner"> <a href="../../index.htm">
|
||||
</a>
|
||||
|
||||
<form method="get" id="searchform" action="../../index.htm">
|
||||
<label for="s" class="assistive-text">Search</label>
|
||||
<input type="submit" class="submit" name="submit" id="searchsubmit" value="Search" />
|
||||
</form>
|
||||
<!-- #access -->
|
||||
</header><!-- #branding -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
<div id="primary">
|
||||
<div id="content" role="main">
|
||||
|
||||
|
||||
|
||||
<article id="post-88" class="post-88 page type-page status-publish hentry">
|
||||
<header class="entry-header">
|
||||
<h1 class="entry-title"> Contacts List</h1>
|
||||
</header>
|
||||
<!-- .entry-header -->
|
||||
|
||||
<div class="entry-content">
|
||||
<p><img class="alignnone size-full wp-image-99" alt="icon_precise" src="icon_precise.png" width="128" height="128" /></p>
|
||||
<p>Contacts List is plugin for unity3d to view mobile contacts information.<br />
|
||||
It works for Android and iOS</p>
|
||||
<p><strong>Quick Start</strong></p>
|
||||
<p>Create new scene and add ContactsListGUI to any gameObject in the scene, the add the scene to build settings and make build on Android or iOS , you will find this build on mobile showing you all your contacts name , all phones number and photo.</p>
|
||||
<p> </p>
|
||||
<p><strong>Slow Start <img src="icon_smile.gif" alt=":)" class="wp-smiley" /> </strong></p>
|
||||
<p>So how this is done and what you have to know to make your own GUI of managing your contacts.</p>
|
||||
<p>All magic come from Contacts class, you can check ContactsListGUI how it is using this class . before any thing you have to call Contacts.LoadContactList(); this will start loading (in seperate thread) all information to this class from your phones including photo as well.</p>
|
||||
<p>
|
||||
Note for iOS after build to xcode you may need to add addressbook.framework to the project</p>
|
||||
<p><strong>Homework</strong></p>
|
||||
<p>go to all property of “Contact c” in previous code and print it to Console</p>
|
||||
<p>Any Question ?</p>
|
||||
<p>if you have any issue please visit<br>
|
||||
<a href="https://github.com/aliessmael/Unity-Contacts-List">https://github.com/aliessmael/Unity-Contacts-List</a></p>
|
||||
</div><!-- .entry-content -->
|
||||
<footer class="entry-meta">
|
||||
</footer><!-- .entry-meta -->
|
||||
</article><!-- #post-88 -->
|
||||
|
||||
<div id="comments">
|
||||
<ol class="commentlist">
|
||||
<!-- #comment-## -->
|
||||
</ol>
|
||||
<!-- #respond -->
|
||||
|
||||
</div><!-- #comments -->
|
||||
|
||||
|
||||
</div><!-- #content -->
|
||||
</div><!-- #primary -->
|
||||
|
||||
|
||||
</div><!-- #main -->
|
||||
|
||||
<footer id="colophon" role="contentinfo"> </footer><!-- #colophon -->
|
||||
</div><!-- #page -->
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
4
Assets/3rd/Contacts/Documentation/index.htm.meta
Executable file
4
Assets/3rd/Contacts/Documentation/index.htm.meta
Executable file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c627e5d2b849d84184d5934bc6a5ac9
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
2657
Assets/3rd/Contacts/Documentation/style.css
Executable file
2657
Assets/3rd/Contacts/Documentation/style.css
Executable file
File diff suppressed because it is too large
Load Diff
4
Assets/3rd/Contacts/Documentation/style.css.meta
Executable file
4
Assets/3rd/Contacts/Documentation/style.css.meta
Executable file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 563e43a7459593542bee2188283a522c
|
||||
DefaultImporter:
|
||||
userData:
|
||||
55
Assets/3rd/Contacts/MssageReceiver.cs
Executable file
55
Assets/3rd/Contacts/MssageReceiver.cs
Executable file
@@ -0,0 +1,55 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
//helper class
|
||||
//it listen for messages comming from plugin
|
||||
public class MssageReceiver : MonoBehaviour {
|
||||
|
||||
void OnInitializeDone( string message )
|
||||
{
|
||||
Contacts.OnInitializeDone ();
|
||||
}
|
||||
|
||||
void OnInitializeFail( string message )
|
||||
{
|
||||
Debug.LogError( "OnInitializeFail : " + message );
|
||||
Contacts.OnInitializeFail (message);
|
||||
}
|
||||
|
||||
void Log( string message )
|
||||
{
|
||||
Debug.Log( "internal log : " + message );
|
||||
}
|
||||
|
||||
void Error( string error )
|
||||
{
|
||||
Debug.LogError( "internal error : " + error );
|
||||
}
|
||||
|
||||
void OnContactReady( string id )
|
||||
{
|
||||
|
||||
debug( "OnContactReady: " + id);
|
||||
|
||||
if( string.IsNullOrEmpty( id ))
|
||||
return;
|
||||
|
||||
int index = int.Parse( id);
|
||||
Contacts.GetContact( index );
|
||||
}
|
||||
|
||||
/*void OnContactReady( string data )
|
||||
{
|
||||
return;
|
||||
//debug( data );
|
||||
byte[] bytes = System.Text.Encoding.UTF8.GetBytes( data );
|
||||
Contact c = new Contact();
|
||||
c.FromBytes( bytes );
|
||||
Contacts.ContactsList.Add( c );
|
||||
}*/
|
||||
|
||||
void debug( string message )
|
||||
{
|
||||
//Debug.Log( message );
|
||||
}
|
||||
}
|
||||
8
Assets/3rd/Contacts/MssageReceiver.cs.meta
Executable file
8
Assets/3rd/Contacts/MssageReceiver.cs.meta
Executable file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a324ef16313f4c9999ad71c639fbaea
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
8
Assets/3rd/Contacts/Plugins.meta
Normal file
8
Assets/3rd/Contacts/Plugins.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: df13f7e11a7a64a11982c44d796b9d14
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5
Assets/3rd/Contacts/Plugins/Android.meta
Executable file
5
Assets/3rd/Contacts/Plugins/Android.meta
Executable file
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a09bc702b546bbe41919a24ff589f9f5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
13
Assets/3rd/Contacts/Plugins/Android/AndroidManifest.xml
Executable file
13
Assets/3rd/Contacts/Plugins/Android/AndroidManifest.xml
Executable file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.aliessmael.contactslist"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="8"
|
||||
android:targetSdkVersion="21" />
|
||||
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
|
||||
</manifest>
|
||||
4
Assets/3rd/Contacts/Plugins/Android/AndroidManifest.xml.meta
Executable file
4
Assets/3rd/Contacts/Plugins/Android/AndroidManifest.xml.meta
Executable file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82867d25fe9e0bd4bbd6537ebeaffbe1
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
BIN
Assets/3rd/Contacts/Plugins/Android/contactslist.jar
Executable file
BIN
Assets/3rd/Contacts/Plugins/Android/contactslist.jar
Executable file
Binary file not shown.
32
Assets/3rd/Contacts/Plugins/Android/contactslist.jar.meta
Normal file
32
Assets/3rd/Contacts/Plugins/Android/contactslist.jar.meta
Normal file
@@ -0,0 +1,32 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cebfed5b9c576a14b9ffa851b23def2e
|
||||
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:
|
||||
BIN
Assets/3rd/Contacts/Plugins/Android/src.7z
Executable file
BIN
Assets/3rd/Contacts/Plugins/Android/src.7z
Executable file
Binary file not shown.
7
Assets/3rd/Contacts/Plugins/Android/src.7z.meta
Normal file
7
Assets/3rd/Contacts/Plugins/Android/src.7z.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43075eea0cfe64cae9aba003b99c2b7c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
5
Assets/3rd/Contacts/Plugins/iOS.meta
Executable file
5
Assets/3rd/Contacts/Plugins/iOS.meta
Executable file
@@ -0,0 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6221e5d2acb99417692633acfc10367a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
13
Assets/3rd/Contacts/Plugins/iOS/Contacts.h
Executable file
13
Assets/3rd/Contacts/Plugins/iOS/Contacts.h
Executable file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Contacts.h
|
||||
// ContactsList
|
||||
//
|
||||
// Created by Apple on 8/4/14.
|
||||
// Copyright (c) 2014 DreamMakers. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface Contacts : NSObject
|
||||
|
||||
@end
|
||||
27
Assets/3rd/Contacts/Plugins/iOS/Contacts.h.meta
Normal file
27
Assets/3rd/Contacts/Plugins/iOS/Contacts.h.meta
Normal file
@@ -0,0 +1,27 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b53b8d4f7e2141528e07d674035ed54
|
||||
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:
|
||||
349
Assets/3rd/Contacts/Plugins/iOS/Contacts.mm
Executable file
349
Assets/3rd/Contacts/Plugins/iOS/Contacts.mm
Executable file
@@ -0,0 +1,349 @@
|
||||
//
|
||||
// Contacts.m
|
||||
// ContactsList
|
||||
//
|
||||
// Created by Apple on 8/4/14.
|
||||
// Copyright (c) 2014 DreamMakers. All rights reserved.
|
||||
//
|
||||
|
||||
#import "Contacts.h"
|
||||
#import <AddressBook/AddressBook.h>
|
||||
#include<pthread.h>
|
||||
|
||||
@implementation Contacts
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
// Helper method to create C string copy
|
||||
char* aliessmael_MakeStringCopy (const char* string)
|
||||
{
|
||||
if (string == NULL)
|
||||
return NULL;
|
||||
|
||||
char* res = (char*)malloc(strlen(string) + 1);
|
||||
strcpy(res, string);
|
||||
return res;
|
||||
}
|
||||
|
||||
@interface ContactItem :NSObject
|
||||
{
|
||||
@public ABRecordRef person;
|
||||
|
||||
@public NSString *name ;
|
||||
@public ABMultiValueRef phoneNumbersRef;
|
||||
@public NSMutableArray *phoneNumber;
|
||||
@public NSMutableArray *phoneNumberType;
|
||||
@public NSMutableArray *emails;
|
||||
@public NSData* image;
|
||||
};
|
||||
@end
|
||||
@implementation ContactItem
|
||||
|
||||
|
||||
@end
|
||||
extern "C" {
|
||||
CFIndex nPeople;
|
||||
CFArrayRef allPeople;
|
||||
NSMutableArray* contactItems;
|
||||
ABAddressBookRef addressBook;
|
||||
|
||||
|
||||
void contact_log( const char* message)
|
||||
{
|
||||
UnitySendMessage("ContactsListMessageReceiver", "Log", message );
|
||||
}
|
||||
|
||||
void contact_error( char* error)
|
||||
{
|
||||
UnitySendMessage("ContactsListMessageReceiver", "Error", error );
|
||||
}
|
||||
|
||||
void contact_loadName( ContactItem* c )
|
||||
{
|
||||
NSString* firstName = (__bridge NSString *)(ABRecordCopyValue(c->person,kABPersonFirstNameProperty));
|
||||
NSString* lastName = (__bridge NSString *)(ABRecordCopyValue(c->person, kABPersonLastNameProperty));
|
||||
|
||||
NSString* f = ( firstName == NULL)?[[NSString alloc]init]:firstName ;
|
||||
NSString* s = ( lastName == NULL)?[[NSString alloc]init]:lastName ;
|
||||
|
||||
c->name = [NSString stringWithFormat:@"%@ %@",f,s];
|
||||
//c->name = aliessmael_MakeStringCopy([name UTF8String]);
|
||||
//return aliessmael_MakeStringCopy([name UTF8String]);
|
||||
}
|
||||
|
||||
void contact_loadPhoneNumbers( ContactItem* c )
|
||||
{
|
||||
c->phoneNumbersRef = ABRecordCopyValue(c->person, kABPersonPhoneProperty);
|
||||
long phonesCount = ABMultiValueGetCount(c->phoneNumbersRef);
|
||||
c->phoneNumber = [NSMutableArray new];
|
||||
c->phoneNumberType = [NSMutableArray new];
|
||||
for (CFIndex i = 0; i < phonesCount ;i++) {
|
||||
NSString *phoneNumber = (__bridge NSString *) ABMultiValueCopyValueAtIndex(c->phoneNumbersRef, i);
|
||||
[c->phoneNumber addObject:phoneNumber];
|
||||
|
||||
CFStringRef locLabel = ABMultiValueCopyLabelAtIndex(c->phoneNumbersRef, i);
|
||||
NSString* phoneLabel = (__bridge NSString*) ABAddressBookCopyLocalizedLabel(locLabel);
|
||||
[c->phoneNumberType addObject:phoneLabel];
|
||||
}
|
||||
}
|
||||
|
||||
void contact_loadEmails( ContactItem* c )
|
||||
{
|
||||
c->emails = [NSMutableArray new];
|
||||
ABMultiValueRef emails = ABRecordCopyValue(c->person, kABPersonEmailProperty);
|
||||
for (CFIndex j=0; j < ABMultiValueGetCount(emails); j++) {
|
||||
NSString* email = ( __bridge NSString*)ABMultiValueCopyValueAtIndex(emails, j);
|
||||
[c->emails addObject:email];
|
||||
//[email release];
|
||||
}
|
||||
CFRelease(emails);
|
||||
}
|
||||
|
||||
void contact_loadPhoto( ContactItem* c )
|
||||
{
|
||||
UIImage *img = nil;
|
||||
c->image = nil;
|
||||
if (c->person != nil && ABPersonHasImageData(c->person)) {
|
||||
if ( &ABPersonCopyImageDataWithFormat != nil ) {
|
||||
NSData * data = (__bridge NSData *)ABPersonCopyImageDataWithFormat(c->person, kABPersonImageFormatThumbnail);
|
||||
|
||||
c->image = data;
|
||||
|
||||
} else {
|
||||
NSData * data = (__bridge NSData *)ABPersonCopyImageData(c->person);
|
||||
c->image = data;
|
||||
|
||||
}
|
||||
//CFRelease( img );
|
||||
|
||||
} else {
|
||||
img= nil;
|
||||
c->image = nil;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void contact_writeString( NSOutputStream *oStream, NSString* str )
|
||||
{
|
||||
if( str == NULL )
|
||||
{
|
||||
short size = 0;
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
}
|
||||
else
|
||||
{
|
||||
const char* data = [str UTF8String];
|
||||
short size = strlen( data);
|
||||
//short size = sizeof(data)/ sizeof(char);
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
[oStream write:(uint8_t *)data maxLength:size];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
const char* contact_toBytes( ContactItem* c )
|
||||
{
|
||||
|
||||
NSOutputStream *oStream = [[NSOutputStream alloc] initToMemory];
|
||||
[oStream open];
|
||||
|
||||
contact_writeString( oStream, NULL);//native id
|
||||
contact_writeString( oStream, c->name );
|
||||
|
||||
short size = 0;
|
||||
if( c->image == NULL)
|
||||
{
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
}
|
||||
else
|
||||
{
|
||||
size = c->image.length;
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
uint8_t * data = (uint8_t *)[c->image bytes];
|
||||
[oStream write: data maxLength:size];
|
||||
}
|
||||
|
||||
if( c->phoneNumber == NULL)
|
||||
{
|
||||
size = 0;
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
}
|
||||
else
|
||||
{
|
||||
size = c->phoneNumber.count;
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
NSString* text1 = [c->phoneNumber objectAtIndex:i];
|
||||
contact_writeString( oStream, text1 );
|
||||
NSString* text2 = [c->phoneNumberType objectAtIndex:i];
|
||||
contact_writeString( oStream, text2 );
|
||||
}
|
||||
}
|
||||
|
||||
if( c->emails == NULL)
|
||||
{
|
||||
size = 0;
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
}
|
||||
else
|
||||
{
|
||||
size = c->emails.count;
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
NSString* text = [c->emails objectAtIndex:i];
|
||||
contact_writeString( oStream, text );
|
||||
contact_writeString( oStream, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
size = 0;
|
||||
[oStream write:(uint8_t *)&size maxLength:2];
|
||||
|
||||
|
||||
|
||||
NSData *contents = [oStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey];
|
||||
[oStream close];
|
||||
NSString* str = [contents base64Encoding];
|
||||
return [str UTF8String];
|
||||
}
|
||||
|
||||
char* getContact( int index )
|
||||
{
|
||||
//NSString* d = [NSString stringWithFormat:@"Get contact of index : %d", index];
|
||||
//contact_log([d UTF8String]);
|
||||
ContactItem* c = [contactItems objectAtIndex:index];
|
||||
const char* data = contact_toBytes(c);
|
||||
return aliessmael_MakeStringCopy(data) ;
|
||||
}
|
||||
|
||||
|
||||
void* contact_load_thread( void *arg)
|
||||
{
|
||||
//ABRecordRef source = ABAddressBookCopyDefaultSource(addressBook);
|
||||
allPeople = ABAddressBookCopyArrayOfAllPeopleInSourceWithSortOrdering(addressBook, nil, kABPersonSortByFirstName);
|
||||
nPeople = ABAddressBookGetPersonCount( addressBook );
|
||||
// NSLog( @"error %@" , *error );
|
||||
// NSLog( @"cont %ld" , nPeople );
|
||||
contactItems = [NSMutableArray new];
|
||||
for ( int i = 0; i < nPeople; i++ )
|
||||
{
|
||||
ContactItem* c = [[ContactItem alloc]init];
|
||||
c->person = CFArrayGetValueAtIndex( allPeople, i );
|
||||
if( c->person == nil)
|
||||
{
|
||||
NSLog( @"contact %d is empty" , i );
|
||||
continue;
|
||||
}
|
||||
|
||||
contact_loadName( c );
|
||||
|
||||
contact_loadPhoneNumbers( c);
|
||||
|
||||
contact_loadEmails( c );
|
||||
|
||||
contact_loadPhoto( c );
|
||||
|
||||
|
||||
[contactItems addObject:c];
|
||||
|
||||
NSString *idStr = [NSString stringWithFormat:@"%d",i];
|
||||
const char* _idStr = [idStr UTF8String] ;
|
||||
//contact_log( _idStr);
|
||||
|
||||
UnitySendMessage("ContactsListMessageReceiver", "OnContactReady", _idStr);
|
||||
|
||||
}
|
||||
UnitySendMessage("ContactsListMessageReceiver", "OnInitializeDone","");
|
||||
|
||||
|
||||
|
||||
CFRelease(addressBook);
|
||||
CFRelease(allPeople);
|
||||
addressBook = NULL;
|
||||
}
|
||||
|
||||
pthread_t thread = NULL;
|
||||
void contact_listContacts()
|
||||
{
|
||||
pthread_create(&(thread), NULL, &contact_load_thread, NULL);
|
||||
}
|
||||
|
||||
void loadIOSContacts()
|
||||
{
|
||||
ABAuthorizationStatus status = ABAddressBookGetAuthorizationStatus();
|
||||
if (status == kABAuthorizationStatusDenied) {
|
||||
// if you got here, user had previously denied/revoked permission for your
|
||||
// app to access the contacts, and all you can do is handle this gracefully,
|
||||
// perhaps telling the user that they have to go to settings to grant access
|
||||
// to contacts
|
||||
NSLog(@"permissin issu");
|
||||
[[[UIAlertView alloc] initWithTitle:nil message:@"This app requires access to your contacts to function properly. Please visit to the \"Privacy\" section in the iPhone Settings app." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
|
||||
|
||||
UnitySendMessage("ContactsListMessageReceiver", "OnInitializeFail","kABAuthorizationStatusDenied");
|
||||
|
||||
return;
|
||||
}
|
||||
CFErrorRef *error = NULL;
|
||||
addressBook = ABAddressBookCreateWithOptions(NULL, error );
|
||||
if (error) {
|
||||
NSLog(@"error: %@", CFBridgingRelease(error));
|
||||
if (addressBook)
|
||||
CFRelease(addressBook);
|
||||
UnitySendMessage("ContactsListMessageReceiver", "OnInitializeFail","Can not create addressbook");
|
||||
return;
|
||||
}
|
||||
if (status == kABAuthorizationStatusNotDetermined)
|
||||
{
|
||||
|
||||
// present the user the UI that requests permission to contacts ...
|
||||
|
||||
ABAddressBookRequestAccessWithCompletion(addressBook, ^(bool granted, CFErrorRef error) {
|
||||
if (granted) {
|
||||
// if they gave you permission, then just carry on
|
||||
|
||||
contact_listContacts();
|
||||
}
|
||||
else
|
||||
{
|
||||
// however, if they didn't give you permission, handle it gracefully, for example...
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// BTW, this is not on the main thread, so dispatch UI updates back to the main queue
|
||||
|
||||
[[[UIAlertView alloc] initWithTitle:nil message:@"This app requires access to your contacts to function properly. Please visit to the \"Privacy\" section in the iPhone Settings app." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
|
||||
});
|
||||
UnitySendMessage("ContactsListMessageReceiver", "OnInitializeFail","kABAuthorizationStatusNotDetermined");
|
||||
}
|
||||
|
||||
//CFRelease(addressBook);
|
||||
});
|
||||
}
|
||||
else if( status == kABAuthorizationStatusAuthorized )
|
||||
{
|
||||
contact_listContacts();
|
||||
}
|
||||
else
|
||||
{
|
||||
UnitySendMessage("ContactsListMessageReceiver", "OnInitializeFail","unknown issue");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
53
Assets/3rd/Contacts/Plugins/iOS/Contacts.mm.meta
Executable file
53
Assets/3rd/Contacts/Plugins/iOS/Contacts.mm.meta
Executable file
@@ -0,0 +1,53 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3f254f92fbde46cfa034f4afea309ea
|
||||
PluginImporter:
|
||||
serializedVersion: 1
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
platformData:
|
||||
Android:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
Any:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
Editor:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
OSXIntel:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
OSXIntel64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
iOS:
|
||||
enabled: 1
|
||||
settings:
|
||||
CompileFlags:
|
||||
FrameworkDependencies: AddressBook;
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/3rd/Contacts/README.md
Executable file
11
Assets/3rd/Contacts/README.md
Executable file
@@ -0,0 +1,11 @@
|
||||
# Unity-Contacts-List 0.8
|
||||
Unity Contacts List is a unity3d plugin for Android and iOS devices that enable you to access to contacts. Retreive names, phone numbers, and even photos.
|
||||
You can download also from unity asset store
|
||||
https://www.assetstore.unity3d.com/en/#!/content/20885
|
||||
|
||||
To test this asset just drag drop ContactsListGUI script to empty GameObject in your scene.
|
||||
|
||||
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6B8XHP9N5DXBW">
|
||||
<img src="https://www.paypalobjects.com/webstatic/en_US/btn/btn_donate_cc_147x47.png">
|
||||
</img>
|
||||
</a>
|
||||
7
Assets/3rd/Contacts/README.md.meta
Normal file
7
Assets/3rd/Contacts/README.md.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b465cc85190e49639c5458f2bc233f0
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/3rd/Contacts/arial.ttf
Executable file
BIN
Assets/3rd/Contacts/arial.ttf
Executable file
Binary file not shown.
14
Assets/3rd/Contacts/arial.ttf.meta
Executable file
14
Assets/3rd/Contacts/arial.ttf.meta
Executable file
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d9b58d3d46209f47add264db0ce5604
|
||||
TrueTypeFontImporter:
|
||||
serializedVersion: 2
|
||||
fontSize: 22
|
||||
forceTextureCase: -1
|
||||
characterSpacing: 1
|
||||
characterPadding: 0
|
||||
includeFontData: 1
|
||||
use2xBehaviour: 0
|
||||
fontNames: []
|
||||
customCharacters:
|
||||
fontRenderingMode: 0
|
||||
userData:
|
||||
BIN
Assets/3rd/Contacts/contact_face.png
Executable file
BIN
Assets/3rd/Contacts/contact_face.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
47
Assets/3rd/Contacts/contact_face.png.meta
Executable file
47
Assets/3rd/Contacts/contact_face.png.meta
Executable file
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 64e406bc813b7714082f460102114346
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
linearTexture: 0
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -1
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: -1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 0
|
||||
textureType: -1
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
BIN
Assets/3rd/Contacts/even_contact.png
Executable file
BIN
Assets/3rd/Contacts/even_contact.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
47
Assets/3rd/Contacts/even_contact.png.meta
Executable file
47
Assets/3rd/Contacts/even_contact.png.meta
Executable file
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 94469343a75ef624190dd3b00e478906
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
BIN
Assets/3rd/Contacts/odd_contact.png
Executable file
BIN
Assets/3rd/Contacts/odd_contact.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
47
Assets/3rd/Contacts/odd_contact.png.meta
Executable file
47
Assets/3rd/Contacts/odd_contact.png.meta
Executable file
@@ -0,0 +1,47 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f31ebf08b2276ec45897d04ec2590fd1
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
serializedVersion: 2
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 0
|
||||
linearTexture: 1
|
||||
correctGamma: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: .25
|
||||
normalMapFilter: 0
|
||||
isReadable: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: -3
|
||||
maxTextureSize: 1024
|
||||
textureSettings:
|
||||
filterMode: -1
|
||||
aniso: 1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: .5, y: .5}
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spritePixelsToUnits: 100
|
||||
alphaIsTransparency: 1
|
||||
textureType: 2
|
||||
buildTargetSettings: []
|
||||
spriteSheet:
|
||||
sprites: []
|
||||
spritePackingTag:
|
||||
userData:
|
||||
328
Assets/3rd/Contacts/test.unity
Normal file
328
Assets/3rd/Contacts/test.unity
Normal file
@@ -0,0 +1,328 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!29 &1
|
||||
OcclusionCullingSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_OcclusionBakeSettings:
|
||||
smallestOccluder: 5
|
||||
smallestHole: 0.25
|
||||
backfaceThreshold: 100
|
||||
m_SceneGUID: 00000000000000000000000000000000
|
||||
m_OcclusionCullingData: {fileID: 0}
|
||||
--- !u!104 &2
|
||||
RenderSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 9
|
||||
m_Fog: 0
|
||||
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
|
||||
m_FogMode: 3
|
||||
m_FogDensity: 0.01
|
||||
m_LinearFogStart: 0
|
||||
m_LinearFogEnd: 300
|
||||
m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1}
|
||||
m_AmbientIntensity: 1
|
||||
m_AmbientMode: 3
|
||||
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
|
||||
m_SkyboxMaterial: {fileID: 0}
|
||||
m_HaloStrength: 0.5
|
||||
m_FlareStrength: 1
|
||||
m_FlareFadeSpeed: 3
|
||||
m_HaloTexture: {fileID: 0}
|
||||
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_DefaultReflectionMode: 0
|
||||
m_DefaultReflectionResolution: 128
|
||||
m_ReflectionBounces: 1
|
||||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &4
|
||||
LightmapSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 11
|
||||
m_GIWorkflowMode: 1
|
||||
m_GISettings:
|
||||
serializedVersion: 2
|
||||
m_BounceScale: 1
|
||||
m_IndirectOutputScale: 1
|
||||
m_AlbedoBoost: 1
|
||||
m_EnvironmentLightingMode: 0
|
||||
m_EnableBakedLightmaps: 1
|
||||
m_EnableRealtimeLightmaps: 0
|
||||
m_LightmapEditorSettings:
|
||||
serializedVersion: 12
|
||||
m_Resolution: 1
|
||||
m_BakeResolution: 50
|
||||
m_AtlasSize: 1024
|
||||
m_AO: 1
|
||||
m_AOMaxDistance: 1
|
||||
m_CompAOExponent: 1
|
||||
m_CompAOExponentDirect: 0
|
||||
m_ExtractAmbientOcclusion: 0
|
||||
m_Padding: 2
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_LightmapsBakeMode: 1
|
||||
m_TextureCompression: 0
|
||||
m_FinalGather: 0
|
||||
m_FinalGatherFiltering: 1
|
||||
m_FinalGatherRayCount: 256
|
||||
m_ReflectionCompression: 2
|
||||
m_MixedBakeMode: 1
|
||||
m_BakeBackend: 0
|
||||
m_PVRSampling: 1
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVREnvironmentSampleCount: 500
|
||||
m_PVREnvironmentReferencePointCount: 2048
|
||||
m_PVRFilteringMode: 0
|
||||
m_PVRDenoiserTypeDirect: 0
|
||||
m_PVRDenoiserTypeIndirect: 0
|
||||
m_PVRDenoiserTypeAO: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVREnvironmentMIS: 0
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_UseShadowmask: 0
|
||||
--- !u!196 &5
|
||||
NavMeshSettings:
|
||||
serializedVersion: 2
|
||||
m_ObjectHideFlags: 0
|
||||
m_BuildSettings:
|
||||
serializedVersion: 2
|
||||
agentTypeID: 0
|
||||
agentRadius: 0.5
|
||||
agentHeight: 2
|
||||
agentSlope: 45
|
||||
agentClimb: 0.4
|
||||
ledgeDropHeight: 0
|
||||
maxJumpAcrossDistance: 0
|
||||
minRegionArea: 2
|
||||
manualCellSize: 0
|
||||
cellSize: 0.16666666
|
||||
manualTileSize: 0
|
||||
tileSize: 256
|
||||
accuratePlacement: 0
|
||||
debug:
|
||||
m_Flags: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &365674031
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 365674036}
|
||||
- component: {fileID: 365674035}
|
||||
- component: {fileID: 365674033}
|
||||
- component: {fileID: 365674032}
|
||||
- component: {fileID: 365674037}
|
||||
m_Layer: 0
|
||||
m_Name: Main Camera
|
||||
m_TagString: MainCamera
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!81 &365674032
|
||||
AudioListener:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 365674031}
|
||||
m_Enabled: 1
|
||||
--- !u!124 &365674033
|
||||
Behaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 365674031}
|
||||
m_Enabled: 1
|
||||
--- !u!20 &365674035
|
||||
Camera:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 365674031}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_ClearFlags: 1
|
||||
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844}
|
||||
m_projectionMatrixMode: 1
|
||||
m_GateFitMode: 2
|
||||
m_FOVAxisMode: 0
|
||||
m_SensorSize: {x: 36, y: 24}
|
||||
m_LensShift: {x: 0, y: 0}
|
||||
m_FocalLength: 50
|
||||
m_NormalizedViewPortRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
m_TargetEye: 3
|
||||
m_HDR: 0
|
||||
m_AllowMSAA: 1
|
||||
m_AllowDynamicResolution: 0
|
||||
m_ForceIntoRT: 0
|
||||
m_OcclusionCulling: 1
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
--- !u!4 &365674036
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 365674031}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 1, z: -10}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &365674037
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 365674031}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 596da6aa7e8936543a9c85c2c325edbc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
font: {fileID: 12800000, guid: 6d9b58d3d46209f47add264db0ce5604, type: 3}
|
||||
even_contactTexture: {fileID: 2800000, guid: 94469343a75ef624190dd3b00e478906, type: 3}
|
||||
odd_contactTexture: {fileID: 2800000, guid: f31ebf08b2276ec45897d04ec2590fd1, type: 3}
|
||||
contact_faceTexture: {fileID: 2800000, guid: 64e406bc813b7714082f460102114346, type: 3}
|
||||
--- !u!1 &1962014926
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1962014929}
|
||||
- component: {fileID: 1962014928}
|
||||
- component: {fileID: 1962014927}
|
||||
m_Layer: 0
|
||||
m_Name: Reporter
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!114 &1962014927
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1962014926}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6767a180de870304caa2013b2772dd62, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
isPause: 0
|
||||
luaPath:
|
||||
--- !u!114 &1962014928
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1962014926}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 600c02144c4813244abd262cbcbe8825, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
show: 0
|
||||
UserData:
|
||||
fps: 0
|
||||
fpsText:
|
||||
images:
|
||||
clearImage: {fileID: 2800000, guid: 112c6fcf56e349449ab2e6ad76b67816, type: 3}
|
||||
collapseImage: {fileID: 2800000, guid: 4623f326a884a2546ab39078bf7822c3, type: 3}
|
||||
clearOnNewSceneImage: {fileID: 2800000, guid: 3a6bc61a8319b1949ab9f1f2db1302b4,
|
||||
type: 3}
|
||||
showTimeImage: {fileID: 2800000, guid: 782e03669fa4a614e89ef56252134250, type: 3}
|
||||
showSceneImage: {fileID: 2800000, guid: ff4dfb29f203a174ab8e4c498afe908a, type: 3}
|
||||
userImage: {fileID: 2800000, guid: 2bcdc012e7356f1449ce7d3a31dc458c, type: 3}
|
||||
showMemoryImage: {fileID: 2800000, guid: f447d62f2dacf9843be7cbf168a3a9d0, type: 3}
|
||||
softwareImage: {fileID: 2800000, guid: 6c91fc88ee6c791468318d85febfb48d, type: 3}
|
||||
dateImage: {fileID: 2800000, guid: a7561cd0a9f62a84e99bff1abce2a222, type: 3}
|
||||
showFpsImage: {fileID: 2800000, guid: 90b2f48155dc0e74f8e428561ac79da5, type: 3}
|
||||
infoImage: {fileID: 2800000, guid: 2954bef266e6d794aba08ceacc887a0f, type: 3}
|
||||
searchImage: {fileID: 2800000, guid: bfef37b5a26d2264798616d960451329, type: 3}
|
||||
closeImage: {fileID: 2800000, guid: b65e9be99974bc94eab5d6698811d0b8, type: 3}
|
||||
buildFromImage: {fileID: 2800000, guid: 8702be598dd9f504ca33be2afee2ca33, type: 3}
|
||||
systemInfoImage: {fileID: 2800000, guid: e9011b1dc9256ad4d9c19a31c595f95f, type: 3}
|
||||
graphicsInfoImage: {fileID: 2800000, guid: 999d31716332cc04eb4abc9c9270b0ca, type: 3}
|
||||
backImage: {fileID: 2800000, guid: a0632a18e7c665641b94fea66506ab50, type: 3}
|
||||
logImage: {fileID: 2800000, guid: e876b803a4dd5c5488078071d15aa9c0, type: 3}
|
||||
warningImage: {fileID: 2800000, guid: 1066be8e7b994b94c8a182b8dbe30705, type: 3}
|
||||
errorImage: {fileID: 2800000, guid: 7640ebf8b3a92124d821d3b4b8b3fd7e, type: 3}
|
||||
barImage: {fileID: 2800000, guid: 8128d4f4c0193e34586f9631ef7d4787, type: 3}
|
||||
button_activeImage: {fileID: 2800000, guid: 2580a2e903691e44282e56ed6e0ff37a,
|
||||
type: 3}
|
||||
even_logImage: {fileID: 2800000, guid: d27aad55b568c6544b0b95a95da44bc7, type: 3}
|
||||
odd_logImage: {fileID: 2800000, guid: 8ffbb44a2c3adae45913474e4fd487f5, type: 3}
|
||||
selectedImage: {fileID: 2800000, guid: 17117a429b08e7e43b0b6c8421de69fe, type: 3}
|
||||
reporterScrollerSkin: {fileID: 11400000, guid: 1cc68832d00d3284a9324a4dc05be753,
|
||||
type: 2}
|
||||
size: {x: 32, y: 32}
|
||||
maxSize: 20
|
||||
numOfCircleToShow: 1
|
||||
Initialized: 0
|
||||
--- !u!4 &1962014929
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1962014926}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
4
Assets/3rd/Contacts/test.unity.meta
Executable file
4
Assets/3rd/Contacts/test.unity.meta
Executable file
@@ -0,0 +1,4 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0be18f81137168346b7d8dc32d0f5d54
|
||||
DefaultImporter:
|
||||
userData:
|
||||
8
Assets/3rd/LBSBaidu.meta
Normal file
8
Assets/3rd/LBSBaidu.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6dbea4189f1c4d53a6bd0879357f2bc
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/3rd/LBSBaidu/Plugins.meta
Normal file
8
Assets/3rd/LBSBaidu/Plugins.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0fbe5eaca88d64925adfaaca3a3697da
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/3rd/LBSBaidu/Plugins/Android.meta
Normal file
8
Assets/3rd/LBSBaidu/Plugins/Android.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d98a696ae64ce41eab55acb4903fc0e1
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Assets/3rd/LBSBaidu/Plugins/Android/AndroidManifest.xml
Normal file
40
Assets/3rd/LBSBaidu/Plugins/Android/AndroidManifest.xml
Normal 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>
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c62e9f81ca5148d6b4990bca99a295d
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
181
Assets/3rd/LBSBaidu/Plugins/Android/BaiduLBS.java
Normal file
181
Assets/3rd/LBSBaidu/Plugins/Android/BaiduLBS.java
Normal 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);
|
||||
}
|
||||
}
|
||||
32
Assets/3rd/LBSBaidu/Plugins/Android/BaiduLBS.java.meta
Normal file
32
Assets/3rd/LBSBaidu/Plugins/Android/BaiduLBS.java.meta
Normal 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:
|
||||
BIN
Assets/3rd/LBSBaidu/Plugins/Android/BaiduLBS_Android.jar
Normal file
BIN
Assets/3rd/LBSBaidu/Plugins/Android/BaiduLBS_Android.jar
Normal file
Binary file not shown.
@@ -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:
|
||||
8
Assets/3rd/LBSBaidu/Plugins/Android/libs.meta
Normal file
8
Assets/3rd/LBSBaidu/Plugins/Android/libs.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e17178e9667b44e5a23b62e0036e51c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/3rd/LBSBaidu/Plugins/Android/libs/arm64-v8a.meta
Normal file
8
Assets/3rd/LBSBaidu/Plugins/Android/libs/arm64-v8a.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8d2b0fe67d62c4062b23255b5e799b57
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/3rd/LBSBaidu/Plugins/Android/libs/arm64-v8a/libindoor.so
Normal file
BIN
Assets/3rd/LBSBaidu/Plugins/Android/libs/arm64-v8a/libindoor.so
Normal file
Binary file not shown.
@@ -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:
|
||||
Binary file not shown.
@@ -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:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4afaf2f3b92f4c9f871c3c17f039d51
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
@@ -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:
|
||||
Binary file not shown.
@@ -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:
|
||||
8
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86.meta
Normal file
8
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48752385118814f13a59c7aa27333471
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86/libindoor.so
Normal file
BIN
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86/libindoor.so
Normal file
Binary file not shown.
104
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86/libindoor.so.meta
Normal file
104
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86/libindoor.so.meta
Normal 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:
|
||||
BIN
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86/liblocSDK8a.so
Normal file
BIN
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86/liblocSDK8a.so
Normal file
Binary file not shown.
104
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86/liblocSDK8a.so.meta
Normal file
104
Assets/3rd/LBSBaidu/Plugins/Android/libs/x86/liblocSDK8a.so.meta
Normal 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:
|
||||
22
Assets/3rd/LBSBaidu/Plugins/Android/readme.txt
Normal file
22
Assets/3rd/LBSBaidu/Plugins/Android/readme.txt
Normal 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
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
7
Assets/3rd/LBSBaidu/Plugins/Android/readme.txt.meta
Normal file
7
Assets/3rd/LBSBaidu/Plugins/Android/readme.txt.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bc641ad026294f75abfc3789ab6af29
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/3rd/LBSBaidu/Plugins/iOS.meta
Normal file
8
Assets/3rd/LBSBaidu/Plugins/iOS.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c3550f37999543768218515ea4288ab
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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:
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c3f0f617cc574c88958594fff15430e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aee1ad44c65854e08baf6311f480d818
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02bef3f1d1e52452a8c96ba746dece32
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4789a7241b144488b96b7a18615e07c8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 */
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e680f909b1194595a58dc7b045eddcf
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 */
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cd9a5eed3e7e448798679bedd2effbf
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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"
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5831c77bd3ced4121be2c5cf4b9bd240
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 */
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92f373756c24c43e6889ae47776863d2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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数据,默认是不需要NO;YES的情况下,定位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
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fae39847c7a749778f509bb816c7e00
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9457a1538d29e4c62994c1431e3d459c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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 */
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b52b473fb55a44120b600e020b8f3f09
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f92677fb7cc3a41da8e8555fc61d3449
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,11 @@
|
||||
1、版本:
|
||||
百度地图iOS定位SDK v1.8
|
||||
|
||||
2、是否带IDFA:
|
||||
无
|
||||
|
||||
3、是否为Bitcode:
|
||||
是
|
||||
|
||||
4、集成方法:
|
||||
http://lbsyun.baidu.com/index.php?title=ios-locsdk
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user