package
com.cmcc.locationaddress_gps_sdk_test;
import
com.cmcc.location_gps_sdk.ILocationDetail;
import
com.cmcc.location_gps_sdk.ILocationManger;
import
com.cmcc.location_gps_sdk.IReferenceAddress;
import
com.cmcc.location_gps_sdk.SDKManager;
import
com.example.locationaddress_gps_sdk_test.R;
import
android.os.Bundle;
import
android.util.Log;
import
android.app.Activity;
public
class
MainActivity
extends
Activity {
private
ILocationManger iLtionMInstance;
@Override
protected
void
onCreate(Bundle savedInstanceState) {
super
.onCreate(savedInstanceState);
iLtionMInstance = SDKManager.getILocationMangerInstance(getApplicationContext());
iLtionMInstance.getCurrentLocation(iLocatDE);
setContentView(R.layout.activity_main);
testLocationAddress();
}
ILocationDetail iLocatDE =
new
ILocationDetail() {
public
void
getLocationDetial(String city) {
Log.i(
"tag"
,
"定位的城市"
+city);
}
};
private
void
testLocationAddress() {
for
(
int
i=
0
;i<strArray.length;i++)
{
String addressName = strArray[i];
Log.i(
"tag"
,
"地址"
+addressName);
iLtionMInstance.setDisList(addressName);
}
iLtionMInstance.getLocationByAdrdress(referCB);
}
IReferenceAddress referCB =
new
IReferenceAddress() {
@Override
public
void
getIReferenceAddress(
double
distance) {
Log.i(
"distance"
,
"距离-->"
+distance);
}
};
String[] strArray={
"北京市西城区宣武门西大2号"
,
"北京市西城区宣武门西大街28号"
,
"北京市朝阳区慧忠北里309-6号第5大道精品休闲购物广场B2层"
,
"北京市海淀区北安河路68号"
,
"北京市昌平区回龙观北店嘉园26号"
,
"北京市大兴区北程庄金星路"
,
" 北京市大兴区天宝园五里一区22号"
,
"北京市海淀区西三旗桥东"
,
"北京市朝阳区安定路甲3号"
,
" 北京市海淀区上地十街10号"
,
"北京市朝阳区慧忠北里309-6号第5大道精品休闲购物广场B2层"
,
"北京市海淀区怡美家园"
,
"北京市海淀区交通大学路"
,
"北京市海淀区交通大学路1号院"
,
"北京市丰台区北京西站南路168号513室"
,
"朝阳区崔各庄乡大望京村"
,
" 昌平科技园区星火街9号"
,
"北京市昌平区立汤路186号龙德广场五层"
,
"昌平区兴寿镇东营村上东路和上西路交叉口"
,
" 北京市朝阳区将台乡尚君庙28号"
,
"北京市昌平区南口镇马坊村"
,
"北京市昌平区于新庄路"
,
"北京市昌平区北七家镇政府街东"
,
"北京市西城区真武庙二条5号"
,
"北京西城区永安路175号"
,
" 西城区真武庙二条5号"
,
"北京市西城区复兴门外大街19号楼"
};
}
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
manifest
xmlns:android
=
"http://schemas.android.com/apk/res/android"
package
=
"com.cmcc.locationaddress_gps_sdk_test"
android:versionCode
=
"1"
android:versionName
=
"1.0"
>
<
uses-sdk
android:minSdkVersion
=
"8"
android:targetSdkVersion
=
"19"
/>
<
uses-permission
android:name
=
"android.permission.GET_ACCOUNTS"
/>
<
uses-permission
android:name
=
"android.permission.USE_CREDENTIALS"
/>
<
uses-permission
android:name
=
"android.permission.MANAGE_ACCOUNTS"
/>
<
uses-permission
android:name
=
"android.permission.AUTHENTICATE_ACCOUNTS"
/>
<
uses-permission
android:name
=
"com.android.launcher.permission.READ_SETTINGS"
/>
<
uses-permission
android:name
=
"android.permission.BROADCAST_STICKY"
/>
<
uses-permission
android:name
=
"android.permission.WRITE_SETTINGS"
/>
<
uses-permission
android:name
=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<
uses-permission
android:name
=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<
uses-permission
android:name
=
"android.permission.READ_CONTACTS"
/>
<
uses-permission
android:name
=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
/>
<
user-permission
android:name
=
"androdid.permission.USER_PRESENT"
/>
<
uses-permission
android:name
=
"android.permission.ACCESS_COARSE_LOCATION"
></
uses-permission
>
<
uses-permission
android:name
=
"android.permission.ACCESS_FINE_LOCATION"
></
uses-permission
>
<
uses-permission
android:name
=
"android.permission.ACCESS_WIFI_STATE"
></
uses-permission
>
<
uses-permission
android:name
=
"android.permission.ACCESS_NETWORK_STATE"
></
uses-permission
>
<
uses-permission
android:name
=
"android.permission.CHANGE_WIFI_STATE"
></
uses-permission
>
<
uses-permission
android:name
=
"android.permission.READ_PHONE_STATE"
></
uses-permission
>
<
uses-permission
android:name
=
"android.permission.WRITE_EXTERNAL_STORAGE"
></
uses-permission
>
<
uses-permission
android:name
=
"android.permission.INTERNET"
/>
<
uses-permission
android:name
=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
></
uses-permission
>
<
uses-permission
android:name
=
"android.permission.READ_LOGS"
></
uses-permission
>
<
application
android:allowBackup
=
"true"
android:icon
=
"@drawable/ic_launcher"
android:label
=
"@string/app_name"
android:theme
=
"@style/AppTheme"
>
<
meta-data
android:name
=
"com.baidu.lbsapi.API_KEY"
android:value
=
"B0VmM0G0rGu3cSPsfzjUfS7k"
/>
<
service
android:name
=
"com.baidu.location.f"
android:enabled
=
"true"
android:permission
=
"android.permission.BAIDU_LOCATION_SERVICE"
android:process
=
":remote"
>
<
intent-filter
>
<
action
android:name
=
"com.baidu.location.service_v2.4"
/>
</
intent-filter
>
</
service
>
<
activity
android:name
=
"com.cmcc.locationaddress_gps_sdk_test.MainActivity"
android:label
=
"@string/app_name"
>
<
intent-filter
>
<
action
android:name
=
"android.intent.action.MAIN"
/>
<
category
android:name
=
"android.intent.category.LAUNCHER"
/>
</
intent-filter
>
</
activity
>
</
application
>
</
manifest
>