first commit
15
clientAppOne/.gitignore
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
1
clientAppOne/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
4fff03da-7cd6-48ab-8de2-c5cc6e8b1d30
|
||||
1
clientAppOne/app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
1
clientAppOne/app/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
3ce68cbd-aada-42ea-be25-09702e2dba89
|
||||
69
clientAppOne/app/build.gradle
Normal file
@@ -0,0 +1,69 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.bmy.clientappone"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
ndk {
|
||||
//设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so)
|
||||
abiFilters "armeabi", "armeabi-v7a", "arm64-v8a", "x86","arm64-v8a","x86_64"
|
||||
}
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
//调试版的keystore
|
||||
debug {
|
||||
storeFile file("/Users/bmy/Tools/key.jks")
|
||||
storePassword "lb714500"
|
||||
keyAlias "key"
|
||||
keyPassword "lb714500"
|
||||
}
|
||||
//发布版的keystore
|
||||
release {
|
||||
storeFile file("/Users/bmy/Tools/key.jks")
|
||||
storePassword "lb714500"
|
||||
keyAlias "key"
|
||||
keyPassword "lb714500"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
//定位功能
|
||||
compile 'com.amap.api:location:latest.integration'
|
||||
//搜索功能
|
||||
compile 'com.amap.api:search:latest.integration'
|
||||
//3D地图so及jar
|
||||
compile 'com.amap.api:3dmap:latest.integration'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
|
||||
implementation 'com.ejlchina:okhttps-gson:3.1.3'
|
||||
}
|
||||
1
clientAppOne/app/libs/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
c1f7038f-b16b-4ff8-819f-f15b872e7700
|
||||
21
clientAppOne/app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
1
clientAppOne/app/src/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
179845e2-1a2c-4c8c-a11b-11ecf129ca58
|
||||
1
clientAppOne/app/src/androidTest/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
e0b1245e-ba24-4029-b069-690130b454f0
|
||||
1
clientAppOne/app/src/androidTest/java/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
ad34b3cd-d558-4021-b1e6-2266c23d59c1
|
||||
1
clientAppOne/app/src/androidTest/java/com/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
066a58c3-d308-4296-b779-94e3056412ba
|
||||
1
clientAppOne/app/src/androidTest/java/com/bmy/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
f6d0b689-abce-4481-b206-baa2e824e0fd
|
||||
@@ -0,0 +1 @@
|
||||
eadded64-405e-4e64-abaa-7c7005cb10e5
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.bmy.clientappone;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.bmy.clientappone", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
1
clientAppOne/app/src/main/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
2c64e9ab-a201-4ab0-afbb-2efd2f2c0879
|
||||
79
clientAppOne/app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.bmy.clientappone">
|
||||
|
||||
<!-- Normal Permissions 不需要运行时注册 -->
|
||||
<!-- 获取运营商信息,用于支持提供运营商信息相关的接口 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
<!-- 用于访问wifi网络信息,wifi信息会用于进行网络定位 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||
<!-- 这个权限用于获取wifi的获取权限,wifi信息会用来进行网络定位 -->
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
|
||||
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>
|
||||
|
||||
<!-- 请求网络 -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<!-- 不是SDK需要的权限,是示例中的后台唤醒定位需要的权限 -->
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.DEVICE_POWER"/>
|
||||
|
||||
<!-- 需要运行时注册的权限 -->
|
||||
<!-- 用于进行网络定位 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<!-- 用于访问GPS定位 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<!-- 用于提高GPS定位速度 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
|
||||
<!-- 写入扩展存储,向扩展卡写入数据,用于写入缓存定位数据 -->
|
||||
<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_PHONE_STATE"/>
|
||||
<!-- 更改设置 -->
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
|
||||
<!--如果设置了target >= 28 如果需要启动后台定位则必须声明这个权限-->
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||
<!--如果您的应用需要后台定位权限,且有可能运行在Android Q设备上,并且设置了target>28,必须增加这个权限声明-->
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.TTS_SERVICE" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:name=".MyApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
android:theme="@style/Theme.ClientAppOne">
|
||||
|
||||
<!--高德地图地位配置 开始-->
|
||||
<service
|
||||
android:name="com.amap.api.location.APSService"
|
||||
android:foregroundServiceType="location" />
|
||||
|
||||
<!-- 设置key -->
|
||||
<meta-data
|
||||
android:name="com.amap.api.v2.apikey"
|
||||
android:value="e014b4952c20f3a46972f79d27257c74"/>
|
||||
<!--高德地图地位配置 结束-->
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
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>
|
||||
1
clientAppOne/app/src/main/java/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
bd7acbc0-b44f-4a5d-94b5-de6a2fa969ba
|
||||
1
clientAppOne/app/src/main/java/com/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
78024cdb-10c3-4845-adb2-09284dfb14b9
|
||||
1
clientAppOne/app/src/main/java/com/bmy/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
32c8dd8a-c84e-49d1-bbaa-5a6042053576
|
||||
@@ -0,0 +1 @@
|
||||
a3a8e869-4a2b-4697-9a69-5dabe0c59315
|
||||
@@ -0,0 +1,219 @@
|
||||
package com.bmy.clientappone;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
/**
|
||||
* 继承了Activity,实现Android6.0的运行时权限检测
|
||||
* 需要进行运行时权限检测的Activity可以继承这个类
|
||||
*
|
||||
* @创建时间:2016年5月27日 下午3:01:31
|
||||
* @项目名称: AMapLocationDemo
|
||||
* @author hongming.wang
|
||||
* @文件名称:PermissionsChecker.java
|
||||
* @类型名称:PermissionsChecker
|
||||
* @since 2.5.0
|
||||
*/
|
||||
public class CheckPermissionsActivity extends Activity {
|
||||
//是否需要检测后台定位权限,设置为true时,如果用户没有给予后台定位权限会弹窗提示
|
||||
private boolean needCheckBackLocation = false;
|
||||
//如果设置了target > 28,需要增加这个权限,否则不会弹出"始终允许"这个选择框
|
||||
private static String BACKGROUND_LOCATION_PERMISSION = "android.permission.ACCESS_BACKGROUND_LOCATION";
|
||||
/**
|
||||
* 需要进行检测的权限数组
|
||||
*/
|
||||
protected String[] needPermissions = {
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_PHONE_STATE
|
||||
};
|
||||
|
||||
private static final int PERMISSON_REQUESTCODE = 0;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if(Build.VERSION.SDK_INT > 28
|
||||
&& getApplicationContext().getApplicationInfo().targetSdkVersion > 28) {
|
||||
needPermissions = new String[] {
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.WRITE_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE,
|
||||
Manifest.permission.READ_PHONE_STATE,
|
||||
BACKGROUND_LOCATION_PERMISSION
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否需要检测,防止不停的弹框
|
||||
*/
|
||||
private boolean isNeedCheck = true;
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if (Build.VERSION.SDK_INT >= 23
|
||||
&& getApplicationInfo().targetSdkVersion >= 23) {
|
||||
if (isNeedCheck) {
|
||||
checkPermissions(needPermissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param permissions
|
||||
* @since 2.5.0
|
||||
*
|
||||
*/
|
||||
private void checkPermissions(String... permissions) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= 23
|
||||
&& getApplicationInfo().targetSdkVersion >= 23) {
|
||||
List<String> needRequestPermissonList = findDeniedPermissions(permissions);
|
||||
if (null != needRequestPermissonList
|
||||
&& needRequestPermissonList.size() > 0) {
|
||||
String[] array = needRequestPermissonList.toArray(new String[needRequestPermissonList.size()]);
|
||||
Method method = getClass().getMethod("requestPermissions", new Class[]{String[].class,
|
||||
int.class});
|
||||
|
||||
method.invoke(this, array, PERMISSON_REQUESTCODE);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限集中需要申请权限的列表
|
||||
*
|
||||
* @param permissions
|
||||
* @return
|
||||
* @since 2.5.0
|
||||
*
|
||||
*/
|
||||
private List<String> findDeniedPermissions(String[] permissions) {
|
||||
List<String> needRequestPermissonList = new ArrayList<String>();
|
||||
if (Build.VERSION.SDK_INT >= 23
|
||||
&& getApplicationInfo().targetSdkVersion >= 23){
|
||||
try {
|
||||
for (String perm : permissions) {
|
||||
Method checkSelfMethod = getClass().getMethod("checkSelfPermission", String.class);
|
||||
Method shouldShowRequestPermissionRationaleMethod = getClass().getMethod("shouldShowRequestPermissionRationale",
|
||||
String.class);
|
||||
if ((Integer)checkSelfMethod.invoke(this, perm) != PackageManager.PERMISSION_GRANTED
|
||||
|| (Boolean)shouldShowRequestPermissionRationaleMethod.invoke(this, perm)) {
|
||||
if(!needCheckBackLocation
|
||||
&& BACKGROUND_LOCATION_PERMISSION.equals(perm)) {
|
||||
continue;
|
||||
}
|
||||
needRequestPermissonList.add(perm);
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
||||
}
|
||||
}
|
||||
return needRequestPermissonList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测是否所有的权限都已经授权
|
||||
* @param grantResults
|
||||
* @return
|
||||
* @since 2.5.0
|
||||
*
|
||||
*/
|
||||
private boolean verifyPermissions(int[] grantResults) {
|
||||
for (int result : grantResults) {
|
||||
if (result != PackageManager.PERMISSION_GRANTED) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@TargetApi(23)
|
||||
public void onRequestPermissionsResult(int requestCode,
|
||||
String[] permissions, int[] paramArrayOfInt) {
|
||||
if (requestCode == PERMISSON_REQUESTCODE) {
|
||||
if (!verifyPermissions(paramArrayOfInt)) {
|
||||
showMissingPermissionDialog();
|
||||
isNeedCheck = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示提示信息
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
*/
|
||||
private void showMissingPermissionDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("提示");
|
||||
builder.setMessage("前应用缺少必要权限。\\n\\n请点击\\\"设置\\\"-\\\"权限\\\"-打开所需权限。");
|
||||
|
||||
// 拒绝, 退出应用
|
||||
builder.setNegativeButton("取消",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
builder.setPositiveButton("设置",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
startAppSettings();
|
||||
}
|
||||
});
|
||||
|
||||
builder.setCancelable(false);
|
||||
|
||||
builder.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动应用的设置
|
||||
*
|
||||
* @since 2.5.0
|
||||
*
|
||||
*/
|
||||
private void startAppSettings() {
|
||||
Intent intent = new Intent(
|
||||
Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if(keyCode == KeyEvent.KEYCODE_BACK){
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,476 @@
|
||||
package com.bmy.clientappone;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.speech.tts.TextToSpeech;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
import com.amap.api.location.AMapLocationClientOption;
|
||||
import com.amap.api.location.AMapLocationListener;
|
||||
import com.amap.api.location.AMapLocationQualityReport;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.services.route.DistanceResult;
|
||||
import com.amap.api.services.route.DistanceSearch;
|
||||
import com.bmy.clientappone.utils.Utils;
|
||||
import com.bmy.clientappone.utils.DistanceUtils;
|
||||
import com.ejlchina.okhttps.GsonMsgConvertor;
|
||||
import com.ejlchina.okhttps.HTTP;
|
||||
import com.ejlchina.okhttps.WebSocket;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class MainActivity extends CheckPermissionsActivity implements View.OnClickListener {
|
||||
private TextView tvResult;
|
||||
private Button btLocation;
|
||||
|
||||
private AMapLocationClient locationClient = null;
|
||||
private AMapLocationClientOption locationOption = null;
|
||||
|
||||
private PowerManager.WakeLock mWakeLock = null;
|
||||
|
||||
private int Nums = 1;
|
||||
|
||||
private TextToSpeech mSpeech;
|
||||
|
||||
private HTTP http = null;
|
||||
private WebSocket ws = null;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
setTitle(R.string.title_locationBackground);
|
||||
initView();
|
||||
initOkHttps();
|
||||
initLocation();
|
||||
}
|
||||
|
||||
|
||||
//初始化控件
|
||||
private void initView(){
|
||||
tvResult = (TextView) findViewById(R.id.tv_result);
|
||||
btLocation = (Button) findViewById(R.id.bt_location);
|
||||
btLocation.setOnClickListener(this);
|
||||
mSpeech = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
|
||||
@Override
|
||||
public void onInit(int status) {
|
||||
if (status == TextToSpeech.SUCCESS) {
|
||||
mSpeech.setLanguage(Locale.CHINESE);
|
||||
mSpeech.setPitch(1.5f);// 设置音调,值越大声音越尖(女生),值越小则变成男声,1.0是常规
|
||||
mSpeech.setSpeechRate(0.5f);//设置速度
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化
|
||||
private void initOkHttps() {
|
||||
// 构建实例
|
||||
http = HTTP.builder()
|
||||
.baseUrl("ws://120.27.144.174:8080")
|
||||
.build();
|
||||
ws = http.webSocket("/html")
|
||||
.listen();
|
||||
// 获取当前的连接状态
|
||||
int status = ws.status();
|
||||
if (status == WebSocket.STATUS_CONNECTING) {
|
||||
Log.d("1: ", "WebSocket正在连接...");
|
||||
ShowToast("1:WebSocket正在连接...");
|
||||
}
|
||||
if (status == WebSocket.STATUS_CONNECTED) {
|
||||
Log.d("2: ", "WebSocket已建立连接...");
|
||||
ShowToast("2:WebSocket已建立连接...");
|
||||
}
|
||||
if (status == WebSocket.STATUS_DISCONNECTED) {
|
||||
Log.d("3: ", "WebSocket已断开连接(正常断开)...");
|
||||
ShowToast("3:WebSocket已断开连接(正常断开)...");
|
||||
}
|
||||
if (status == WebSocket.STATUS_CANCELED) {
|
||||
Log.d("4: ", "WebSocket已取消连接...");
|
||||
ShowToast("4:WebSocket已取消连接...");
|
||||
}
|
||||
if (status == WebSocket.STATUS_TIMEOUT) {
|
||||
Log.d("5: ", "WebSocket已连接超时...");
|
||||
ShowToast("5:WebSocket已连接超时...");
|
||||
}
|
||||
if (status == WebSocket.STATUS_NETWORK_ERROR) {
|
||||
Log.d("6: ", "WebSocket连接网络错误...");
|
||||
ShowToast("6:WebSocket连接网络错误...");
|
||||
}
|
||||
if (status == WebSocket.STATUS_EXCEPTION) {
|
||||
Log.d("7: ", "WebSocket连接发生异常...");
|
||||
ShowToast("7:WebSocket连接发生异常...");
|
||||
}
|
||||
}
|
||||
|
||||
private void sendMessage() {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
jsonObject.put("type", 1);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ws.send(jsonObject.toString());
|
||||
}
|
||||
|
||||
private void ShowToast(String text) {
|
||||
Toast toast = Toast.makeText(this, text, Toast.LENGTH_SHORT);
|
||||
toast.setGravity(Gravity.CENTER, 0, 0);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.bt_location) {
|
||||
if (btLocation.getText().equals(getResources().getString(R.string.startLocation))) {
|
||||
Nums = 1;
|
||||
btLocation.setText(getResources().getString(R.string.stopLocation));
|
||||
tvResult.setText("正在定位...");
|
||||
startLocation();
|
||||
} else {
|
||||
btLocation.setText(getResources().getString(
|
||||
R.string.startLocation));
|
||||
stopLocation();
|
||||
tvResult.setText("定位停止");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化定位
|
||||
*
|
||||
* @since 2.8.0
|
||||
* @author hongming.wang
|
||||
*
|
||||
*/
|
||||
private void initLocation(){
|
||||
//初始化client
|
||||
locationClient = new AMapLocationClient(this.getApplicationContext());
|
||||
locationOption = getDefaultOption();
|
||||
//设置定位参数
|
||||
locationClient.setLocationOption(locationOption);
|
||||
// 设置定位监听
|
||||
locationClient.setLocationListener(locationListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认的定位参数
|
||||
* @since 2.8.0
|
||||
* @author hongming.wang
|
||||
*
|
||||
*/
|
||||
private AMapLocationClientOption getDefaultOption(){
|
||||
AMapLocationClientOption mOption = new AMapLocationClientOption();
|
||||
mOption.setLocationPurpose(AMapLocationClientOption.AMapLocationPurpose.Sport);
|
||||
mOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);//可选,设置定位模式,可选的模式有高精度、仅设备、仅网络。默认为高精度模式
|
||||
mOption.setGpsFirst(true);//可选,设置是否gps优先,只在高精度模式下有效。默认关闭
|
||||
mOption.setHttpTimeOut(30000);//可选,设置网络请求超时时间。默认为30秒。在仅设备模式下无效
|
||||
mOption.setInterval(5000);//可选,设置定位间隔。默认为5秒
|
||||
mOption.setNeedAddress(true);//可选,设置是否返回逆地理地址信息。默认是true
|
||||
mOption.setOnceLocation(false);//可选,设置是否单次定位。默认是false
|
||||
mOption.setOnceLocationLatest(false);//可选,设置是否等待wifi刷新,默认为false.如果设置为true,会自动变为单次定位,持续定位时不要使用
|
||||
AMapLocationClientOption.setLocationProtocol(AMapLocationClientOption.AMapLocationProtocol.HTTP);//可选, 设置网络请求的协议。可选HTTP或者HTTPS。默认为HTTP
|
||||
mOption.setSensorEnable(true);//可选,设置是否使用传感器。默认是false
|
||||
mOption.setWifiScan(true); //可选,设置是否开启wifi扫描。默认为true,如果设置为false会同时停止主动刷新,停止以后完全依赖于系统刷新,定位位置可能存在误差
|
||||
mOption.setLocationCacheEnable(true); //可选,设置是否使用缓存定位,默认为true
|
||||
return mOption;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定位监听
|
||||
*/
|
||||
AMapLocationListener locationListener = new AMapLocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged(AMapLocation location) {
|
||||
if (null != location) {
|
||||
|
||||
Log.d("经度=========", String.valueOf(location.getLongitude()));
|
||||
Log.d("纬度=========", String.valueOf(location.getLatitude()));
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
//errCode等于0代表定位成功,其他的为定位失败
|
||||
if(location.getErrorCode() == 0){
|
||||
// 当前实时的地理位置
|
||||
LatLng CurrentLocation = new LatLng(location.getLatitude(),location.getLongitude());
|
||||
// 家的位置
|
||||
LatLng MyHome = new LatLng(31.792928,117.325573);
|
||||
float distance = AMapUtils.calculateLineDistance(CurrentLocation,MyHome);
|
||||
// 触发开灯开空调的条件有:
|
||||
// 1: 离家距离小于等于500米(通过两个经纬度坐标计算差值得出)
|
||||
// 2: 定位精度误差小于等于100米的时候,属于定位较为精准 && location.getAccuracy() <= 100
|
||||
// 3: 排除 基站定位 误差很大的情况,只考虑 GPS,前次定位,缓存定位,WIFI定位等高精度地位
|
||||
// 4: 通知服务器次数没有超过三次,这里设置多次通知的原因是防止单次提醒准确度不够的问题
|
||||
// 多次通知后,关闭GPS定位,停止后台定位,重置计数器,方便下次重新开始!
|
||||
if (distance <= 500 && location.getLocationType() <= 5 && Nums <= 1 ) {
|
||||
mSpeech.speak("您即将到家的第"+Nums+"次提醒,为您提前打开空调和灯!", TextToSpeech.QUEUE_FLUSH, null);
|
||||
Log.d("快到家了:", String.valueOf(distance));
|
||||
|
||||
ShowToast("正在自动打开家里空调和灯!");
|
||||
|
||||
// 发送WebSocket请求通知服务器
|
||||
sendMessage();
|
||||
|
||||
// 第三次通知,那么停止定位,修改按钮状态
|
||||
if (Nums == 1) {
|
||||
btLocation.setText(getResources().getString(R.string.startLocation));
|
||||
stopLocation();
|
||||
tvResult.setText("提醒结束,停止定位!");
|
||||
Nums = 1;
|
||||
Log.d("", "提醒结束,停止定位!");
|
||||
} else {
|
||||
TextResult(sb, location);
|
||||
}
|
||||
Nums += 1;
|
||||
// 没到家或者已经到家并完成了开灯开空调的操作!
|
||||
} else {
|
||||
ShowToast("还没到家,距离加还有 "+String.valueOf(distance/1000)+" 公里!");
|
||||
Log.d("还没到家,还剩:", String.valueOf(distance));
|
||||
TextResult(sb, location);
|
||||
}
|
||||
} else {
|
||||
//定位失败
|
||||
sb.append("定位失败" + "\n");
|
||||
sb.append("错误码:" + location.getErrorCode() + "\n");
|
||||
sb.append("错误信息:" + location.getErrorInfo() + "\n");
|
||||
sb.append("错误描述:" + location.getLocationDetail() + "\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
tvResult.setText("定位失败,loc is null");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void TextResult (StringBuffer sb, AMapLocation location) {
|
||||
sb.append("定位成功" + "\n");
|
||||
sb.append("定位类型: " + location.getLocationType() + "\n");
|
||||
sb.append("经 度 : " + location.getLongitude() + "\n");
|
||||
sb.append("纬 度 : " + location.getLatitude() + "\n");
|
||||
sb.append("精 度 : " + location.getAccuracy() + "米" + "\n");
|
||||
//定位完成的时间
|
||||
sb.append("定位时间: " + Utils.formatUTC(location.getTime(), "yyyy-MM-dd HH:mm:ss") + "\n");
|
||||
//定位之后的回调时间
|
||||
sb.append("回调时间: " + Utils.formatUTC(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss") + "\n\n");
|
||||
sb.append("***定位质量报告***").append("\n");
|
||||
sb.append("* WIFI开关:").append(location.getLocationQualityReport().isWifiAble() ? "开启":"关闭").append("\n");
|
||||
sb.append("* GPS状态:").append(getGPSStatusString(location.getLocationQualityReport().getGPSStatus())).append("\n");
|
||||
sb.append("* GPS星数:").append(location.getLocationQualityReport().getGPSSatellites()).append("\n");
|
||||
sb.append("****************").append("\n");
|
||||
//解析定位结果,
|
||||
String result = sb.toString();
|
||||
tvResult.setText(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取唤醒锁
|
||||
*/
|
||||
@SuppressLint("InvalidWakeLockTag")
|
||||
private void acquireWakeLock() {
|
||||
if(mWakeLock == null) {
|
||||
PowerManager mPM = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
|
||||
mWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK | PowerManager.ON_AFTER_RELEASE,"PlayService");
|
||||
if(mWakeLock!=null) {
|
||||
mWakeLock.acquire();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取GPS状态的字符串
|
||||
* @param statusCode GPS状态码
|
||||
* @return
|
||||
*/
|
||||
private String getGPSStatusString(int statusCode){
|
||||
String str = "";
|
||||
switch (statusCode){
|
||||
case AMapLocationQualityReport.GPS_STATUS_OK:
|
||||
str = "GPS状态正常";
|
||||
break;
|
||||
case AMapLocationQualityReport.GPS_STATUS_NOGPSPROVIDER:
|
||||
str = "手机中没有GPS Provider,无法进行GPS定位";
|
||||
break;
|
||||
case AMapLocationQualityReport.GPS_STATUS_OFF:
|
||||
str = "GPS关闭,建议开启GPS,提高定位质量";
|
||||
break;
|
||||
case AMapLocationQualityReport.GPS_STATUS_MODE_SAVING:
|
||||
str = "选择的定位模式中不包含GPS定位,建议选择包含GPS定位的模式,提高定位质量";
|
||||
break;
|
||||
case AMapLocationQualityReport.GPS_STATUS_NOGPSPERMISSION:
|
||||
str = "没有GPS定位权限,建议开启gps定位权限";
|
||||
break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// App放到前台后
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if(null != locationClient) {
|
||||
Log.d("切入前台后关闭后台定位功能", "切入前台后关闭后台定位功能");
|
||||
releaseWakeLock();
|
||||
locationClient.disableBackgroundLocation(true);
|
||||
}
|
||||
}
|
||||
|
||||
// App放到后台后
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
boolean isBackground = ((MyApplication)getApplication()).isBackground();
|
||||
if(isBackground){
|
||||
acquireWakeLock();
|
||||
Log.d("如果app已经切入到后台,启动后台定位功能", "如果app已经切入到后台,启动后台定位功能");
|
||||
if(null != locationClient) {
|
||||
locationClient.enableBackgroundLocation(2001, buildNotification("实时读取定位上报服务器中..."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
destroySpeech();
|
||||
releaseWakeLock();
|
||||
destroyLocation();
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
// 开始定位
|
||||
private void startLocation(){
|
||||
// 设置定位参数
|
||||
locationClient.setLocationOption(locationOption);
|
||||
// 启动定位
|
||||
locationClient.startLocation();
|
||||
//启动后台定位
|
||||
// locationClient.enableBackgroundLocation(2001, buildNotification());
|
||||
}
|
||||
|
||||
// 停止定位
|
||||
private void stopLocation(){
|
||||
// 停止定位
|
||||
locationClient.stopLocation();
|
||||
//关闭后台定位
|
||||
locationClient.disableBackgroundLocation(true);
|
||||
}
|
||||
|
||||
// 销毁定位
|
||||
private void destroyLocation(){
|
||||
if (null != locationClient) {
|
||||
/**
|
||||
* 如果AMapLocationClient是在当前Activity实例化的,
|
||||
* 在Activity的onDestroy中一定要执行AMapLocationClient的onDestroy
|
||||
*/
|
||||
locationClient.onDestroy();
|
||||
locationClient = null;
|
||||
locationOption = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 释放锁
|
||||
private void releaseWakeLock() {
|
||||
if(mWakeLock!=null) {
|
||||
mWakeLock.release();
|
||||
mWakeLock = null;
|
||||
}
|
||||
}
|
||||
|
||||
// 销毁TTS语音
|
||||
private void destroySpeech () {
|
||||
if (mSpeech != null) {
|
||||
mSpeech.stop();
|
||||
mSpeech.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
private void createNotificationChannel(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
private static final String NOTIFICATION_CHANNEL_NAME = "BackgroundLocation";
|
||||
private NotificationManager notificationManager = null;
|
||||
boolean isCreateChannel = false;
|
||||
@SuppressLint("NewApi")
|
||||
private Notification buildNotification(String content) {
|
||||
|
||||
Notification.Builder builder = null;
|
||||
Notification notification = null;
|
||||
if(android.os.Build.VERSION.SDK_INT >= 26) {
|
||||
//Android O上对Notification进行了修改,如果设置的targetSDKVersion>=26建议使用此种方式创建通知栏
|
||||
if (null == notificationManager) {
|
||||
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
}
|
||||
String channelId = getPackageName();
|
||||
if(!isCreateChannel) {
|
||||
NotificationChannel notificationChannel = new NotificationChannel(
|
||||
channelId,
|
||||
NOTIFICATION_CHANNEL_NAME,
|
||||
NotificationManager.IMPORTANCE_DEFAULT
|
||||
);
|
||||
notificationChannel.enableLights(true);//是否在桌面icon右上角展示小圆点
|
||||
// 设置通知出现时的震动(如果 android 设备支持的话)
|
||||
notificationChannel.enableVibration(true);
|
||||
notificationChannel.setLightColor(Color.BLUE); //小圆点颜色
|
||||
|
||||
notificationChannel.setShowBadge(true); //是否在久按桌面图标时显示此渠道的通知
|
||||
notificationManager.createNotificationChannel(notificationChannel);
|
||||
isCreateChannel = true;
|
||||
}
|
||||
builder = new Notification.Builder(getApplicationContext(), channelId);
|
||||
} else {
|
||||
builder = new Notification.Builder(getApplicationContext());
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
builder.setContentIntent(PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT));
|
||||
|
||||
builder.setSmallIcon(R.drawable.ic_launcher)
|
||||
.setContentTitle(Utils.getAppName(this))
|
||||
.setContentText(content)
|
||||
.setWhen(System.currentTimeMillis());
|
||||
|
||||
if (android.os.Build.VERSION.SDK_INT >= 16) {
|
||||
notification = builder.build();
|
||||
} else {
|
||||
return builder.getNotification();
|
||||
}
|
||||
return notification;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.bmy.clientappone;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Created by hongming.wang on 2018/1/23.
|
||||
*/
|
||||
|
||||
public class MyApplication extends Application{
|
||||
private int count = 0;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
count ++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
if(count > 0) {
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断app是否在后台
|
||||
* @return
|
||||
*/
|
||||
public boolean isBackground(){
|
||||
if(count <= 0){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
23aa0c3f-84f9-413d-93ca-e8e9e72aaf26
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.bmy.clientappone.utils;
|
||||
|
||||
public class DistanceUtils {
|
||||
/**
|
||||
* 地球半径,单位 km
|
||||
*/
|
||||
private static final double EARTH_RADIUS = 6378137;
|
||||
|
||||
/**
|
||||
* 根据经纬度,计算两点间的距离
|
||||
*
|
||||
* @param longitude1 第一个点的经度
|
||||
* @param latitude1 第一个点的纬度
|
||||
* @param longitude2 第二个点的经度
|
||||
* @param latitude2 第二个点的纬度
|
||||
* @return 返回距离 单位米
|
||||
*/
|
||||
public static double getDistance(double longitude1, double latitude1, double longitude2, double latitude2) {
|
||||
|
||||
double latDistance = Math.toRadians(longitude1 - longitude2);
|
||||
double lngDistance = Math.toRadians(latitude1 - latitude2);
|
||||
|
||||
double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2)
|
||||
+ Math.cos(Math.toRadians(longitude1)) * Math.cos(Math.toRadians(longitude2))
|
||||
* Math.sin(lngDistance / 2) * Math.sin(lngDistance / 2);
|
||||
|
||||
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
|
||||
c = c * EARTH_RADIUS;
|
||||
return Math.round(c * 10000) / 10000;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.bmy.clientappone.utils;
|
||||
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.amap.api.location.AMapLocation;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* 辅助工具类
|
||||
* @创建时间: 2015年11月24日 上午11:46:50
|
||||
* @项目名称: AMapLocationDemo2.x
|
||||
* @author hongming.wang
|
||||
* @文件名称: Utils.java
|
||||
* @类型名称: Utils
|
||||
*/
|
||||
public class Utils {
|
||||
/**
|
||||
* 开始定位
|
||||
*/
|
||||
public final static int MSG_LOCATION_START = 0;
|
||||
/**
|
||||
* 定位完成
|
||||
*/
|
||||
public final static int MSG_LOCATION_FINISH = 1;
|
||||
/**
|
||||
* 停止定位
|
||||
*/
|
||||
public final static int MSG_LOCATION_STOP= 2;
|
||||
|
||||
public final static String KEY_URL = "URL";
|
||||
public final static String URL_H5LOCATION = "file:///android_asset/sdkLoc.html";
|
||||
/**
|
||||
* 根据定位结果返回定位信息的字符串
|
||||
* @param location
|
||||
* @return
|
||||
*/
|
||||
public synchronized static String getLocationStr(AMapLocation location){
|
||||
if(null == location){
|
||||
return null;
|
||||
}
|
||||
StringBuffer sb = new StringBuffer();
|
||||
//errCode等于0代表定位成功,其他的为定位失败,具体的可以参照官网定位错误码说明
|
||||
if(location.getErrorCode() == 0){
|
||||
sb.append("定位成功" + "\n");
|
||||
sb.append("定位类型: " + location.getLocationType() + "\n");
|
||||
sb.append("经 度 : " + location.getLongitude() + "\n");
|
||||
sb.append("纬 度 : " + location.getLatitude() + "\n");
|
||||
sb.append("精 度 : " + location.getAccuracy() + "米" + "\n");
|
||||
sb.append("提供者 : " + location.getProvider() + "\n");
|
||||
|
||||
sb.append("速 度 : " + location.getSpeed() + "米/秒" + "\n");
|
||||
sb.append("角 度 : " + location.getBearing() + "\n");
|
||||
// 获取当前提供定位服务的卫星个数
|
||||
sb.append("星 数 : " + location.getSatellites() + "\n");
|
||||
sb.append("国 家 : " + location.getCountry() + "\n");
|
||||
sb.append("省 : " + location.getProvince() + "\n");
|
||||
sb.append("市 : " + location.getCity() + "\n");
|
||||
sb.append("城市编码 : " + location.getCityCode() + "\n");
|
||||
sb.append("区 : " + location.getDistrict() + "\n");
|
||||
sb.append("区域 码 : " + location.getAdCode() + "\n");
|
||||
sb.append("地 址 : " + location.getAddress() + "\n");
|
||||
sb.append("兴趣点 : " + location.getPoiName() + "\n");
|
||||
//定位完成的时间
|
||||
sb.append("定位时间: " + formatUTC(location.getTime(), "yyyy-MM-dd HH:mm:ss") + "\n");
|
||||
} else {
|
||||
//定位失败
|
||||
sb.append("定位失败" + "\n");
|
||||
sb.append("错误码:" + location.getErrorCode() + "\n");
|
||||
sb.append("错误信息:" + location.getErrorInfo() + "\n");
|
||||
sb.append("错误描述:" + location.getLocationDetail() + "\n");
|
||||
}
|
||||
//定位之后的回调时间
|
||||
sb.append("回调时间: " + formatUTC(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss") + "\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static SimpleDateFormat sdf = null;
|
||||
public static String formatUTC(long l, String strPattern) {
|
||||
if (TextUtils.isEmpty(strPattern)) {
|
||||
strPattern = "yyyy-MM-dd HH:mm:ss";
|
||||
}
|
||||
if (sdf == null) {
|
||||
try {
|
||||
sdf = new SimpleDateFormat(strPattern, Locale.CHINA);
|
||||
} catch (Throwable e) {
|
||||
}
|
||||
} else {
|
||||
sdf.applyPattern(strPattern);
|
||||
}
|
||||
return sdf == null ? "NULL" : sdf.format(l);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取app的名称
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
public static String getAppName(Context context) {
|
||||
String appName = "";
|
||||
try {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo(
|
||||
context.getPackageName(), 0);
|
||||
int labelRes = packageInfo.applicationInfo.labelRes;
|
||||
appName = context.getResources().getString(labelRes);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return appName;
|
||||
}
|
||||
}
|
||||
1
clientAppOne/app/src/main/res/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
c2cba96c-ce24-4a2a-811b-43b7de4e9a31
|
||||
1
clientAppOne/app/src/main/res/drawable-v24/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
40d28bf6-8ade-4493-bfe1-471a9c2a4af1
|
||||
@@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
||||
1
clientAppOne/app/src/main/res/drawable/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
dd33a8df-11bd-48e6-b8c7-8a3f4d25675a
|
||||
BIN
clientAppOne/app/src/main/res/drawable/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
@@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|
||||
1
clientAppOne/app/src/main/res/layout/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
a8ca0c64-8515-4c59-878b-01352049a492
|
||||
33
clientAppOne/app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/normal_margin" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center" >
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_location"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text="@string/startLocation"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_result"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/normal_margin" />
|
||||
</ScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
1
clientAppOne/app/src/main/res/mipmap-anydpi-v26/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
40b8d509-37f9-4465-b868-82bc13432da0
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
1
clientAppOne/app/src/main/res/mipmap-hdpi/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
d610204c-4107-4f09-88f7-1c46da631ed7
|
||||
BIN
clientAppOne/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
clientAppOne/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
1
clientAppOne/app/src/main/res/mipmap-mdpi/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
5d33e157-c363-41bb-a191-2191a7a61450
|
||||
BIN
clientAppOne/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
clientAppOne/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
1
clientAppOne/app/src/main/res/mipmap-xhdpi/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
c2f66d90-3faf-4c0d-94b9-9c687777a3b0
|
||||
BIN
clientAppOne/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
clientAppOne/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
1
clientAppOne/app/src/main/res/mipmap-xxhdpi/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
499a7977-4545-4b78-8717-f455c4c54f2d
|
||||
BIN
clientAppOne/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 12 KiB |
1
clientAppOne/app/src/main/res/mipmap-xxxhdpi/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
a5210f57-7294-4600-870b-60fb91acb99f
|
||||
BIN
clientAppOne/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 16 KiB |
1
clientAppOne/app/src/main/res/values-night/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
2ab9ee04-6560-4959-a769-1ca4f819e91e
|
||||
16
clientAppOne/app/src/main/res/values-night/themes.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.ClientAppOne" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_200</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_200</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
1
clientAppOne/app/src/main/res/values/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
27127094-96a7-423b-ad5e-137f00723b48
|
||||
31
clientAppOne/app/src/main/res/values/colors.xml
Executable file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#FF000000</color>
|
||||
|
||||
<color name="grey"> #ebebeb</color>
|
||||
<color name="darkgrey"> #C0C0C0</color>
|
||||
<color name="white"> #FFFFFF</color>
|
||||
<color name="red"> #FF0000</color>
|
||||
<color name="f850_default_blue">#0079ff</color>
|
||||
|
||||
<drawable name="transparent">#00000000</drawable>
|
||||
|
||||
<color name="header_toast_bg">#ccebfc</color>
|
||||
<color name="header_toast">#024ca1</color>
|
||||
<color name="header_toast_line">#abdaf4</color>
|
||||
<color name="offline_down_title">#909090</color>
|
||||
<color name="offline_head_font">#FFFFFF</color>
|
||||
<color name="gary">#898989</color>
|
||||
<color name="taobao_black">#333333</color>
|
||||
<color name="offline_down_size">#777777</color>
|
||||
<color name="gray_lite">#c5c5c5</color>
|
||||
<color name="progress_background">#ededed</color>
|
||||
<color name="blue">#4c90f9</color>
|
||||
|
||||
</resources>
|
||||
27
clientAppOne/app/src/main/res/values/dimens.xml
Executable file
@@ -0,0 +1,27 @@
|
||||
<resources>
|
||||
|
||||
<dimen name="title_text_size">15sp</dimen>
|
||||
<dimen name="city_name_size">20sp</dimen>
|
||||
<dimen name="city_size_size">12sp</dimen>
|
||||
<dimen name="city_progress_size">11sp</dimen>
|
||||
<dimen name="normal_margin">10dp</dimen>
|
||||
<dimen name="font_58">29dp</dimen>
|
||||
<dimen name="font_170">85dp</dimen>
|
||||
|
||||
<dimen name="offline_down_title_hight">25dp</dimen>
|
||||
<dimen name="font_22">11sp</dimen>
|
||||
<dimen name="font_24">12sp</dimen>
|
||||
<dimen name="font_26">13sp</dimen>
|
||||
<dimen name="font_28">14sp</dimen>
|
||||
<dimen name="font_30">15sp</dimen>
|
||||
<dimen name="font_32">16sp</dimen>
|
||||
<dimen name="font_34">17sp</dimen>
|
||||
<dimen name="font_36">18sp</dimen>
|
||||
|
||||
<dimen name="poi_title_size">20sp</dimen>
|
||||
<dimen name="poi_field_size">16sp</dimen>
|
||||
<dimen name="margin_left">15dp</dimen>
|
||||
<dimen name="margin_right">15dp</dimen>
|
||||
<dimen name="margin_middle">2dp</dimen>
|
||||
|
||||
</resources>
|
||||
172
clientAppOne/app/src/main/res/values/strings.xml
Executable file
@@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string name="app_name">GPS位置上报</string>
|
||||
<string name="title_main">高德定位SDK功能展示</string>
|
||||
|
||||
<string name="title_location">获取定位数据</string>
|
||||
<string name="location">获取定位数据</string>
|
||||
<string name="location_dec">调用定位接口获取定位数据</string>
|
||||
|
||||
<string name="title_geoFence">地理围栏</string>
|
||||
<string name="geoFence">地理围栏</string>
|
||||
<string name="geoFence_dec">展示地理围栏功能</string>
|
||||
|
||||
<string name="roundGeoFence">圆形地理围栏</string>
|
||||
<string name="roundGeoFence_dec">展示圆形地理围栏</string>
|
||||
|
||||
<string name="polygonGeoFence">多边形地理围栏</string>
|
||||
<string name="polygonGeoFence_dec">展示多边形地理围栏</string>
|
||||
|
||||
<string name="keywordGeoFence">关键字地理围栏</string>
|
||||
<string name="keywordGeoFence_dec">展示关键字地理围栏</string>
|
||||
|
||||
<string name="nearbyGeoFence">周边地理围栏</string>
|
||||
<string name="nearbyGeoFence_dec">展示周边地理围栏</string>
|
||||
|
||||
<string name="districtGeoFence">行政区划地理围栏</string>
|
||||
<string name="districtGeoFence_dec">展示行政区划地理围栏</string>
|
||||
|
||||
<string name="multipleGeoFence">综合展示</string>
|
||||
<string name="multipleGeoFence_dec">综合展示地理围栏的功能</string>
|
||||
|
||||
|
||||
<string name="oldGeoFence">旧版地理围栏</string>
|
||||
<string name="oldGeoFence_dec">旧版地理围栏,不建议使用</string>
|
||||
|
||||
|
||||
<string name="title_assistantLocation">H5辅助定位</string>
|
||||
<string name="assistantLocation">H5辅助定位</string>
|
||||
<string name="assistantLocation_dec">展示H5辅助定位功能</string>
|
||||
|
||||
<string name="title_tools">地图计算工具</string>
|
||||
<string name="tools">地图计算工具</string>
|
||||
<string name="tools_dec">坐标转换等功能演示</string>
|
||||
|
||||
<string name="title_lastLocation">获取最后一次位置</string>
|
||||
<string name="lastLocation">获取最后一次位置</string>
|
||||
<string name="lastLocation_dec">获取最后一次定位的位置,此位置是一个历史位置</string>
|
||||
|
||||
|
||||
<string name="title_alarmCPU">定时唤起CPU</string>
|
||||
<string name="alarmCPU">定时唤起cpu</string>
|
||||
<string name="alarmCPU_dec">通过一个闹钟程序后台定时唤起cpu</string>
|
||||
|
||||
<string name="title_errorCode">错误码说明</string>
|
||||
<string name="errorCode">错误码说明</string>
|
||||
<string name="errorCode_dec">错误码说明以及对应的解决方法</string>
|
||||
|
||||
<string name="defaultInteval">2000</string>
|
||||
<string name="defaultHttpTimeout">30000</string>
|
||||
|
||||
<string name="battery_saving">低功耗模式</string>
|
||||
<string name="device_sensors">仅设备模式</string>
|
||||
<string name="hight_accuracy">高精度模式</string>
|
||||
<string name="interval">定位周期(ms)</string>
|
||||
<string name="httpTimeout">网络超时(ms)</string>
|
||||
<string name="location_once">单次定位</string>
|
||||
<string name="needAddress">逆地理编码</string>
|
||||
<string name="cacheAble">开启缓存</string>
|
||||
<string name="onceLastest">提高首次定位精度</string>
|
||||
<string name="gpsFirst">GPS优先</string>
|
||||
<string name="useSensor">使用传感器</string>
|
||||
<string name="wifiScan">开启wifi扫描</string>
|
||||
|
||||
<string name="geoLanguage">逆地理语言</string>
|
||||
|
||||
|
||||
<string name="alarmInterval">唤醒周期(s)</string>
|
||||
|
||||
<string name="startLocation">开启后台定位</string>
|
||||
<string name="stopLocation">停止后台定位</string>
|
||||
|
||||
<string name="fenceRadius">围栏半径</string>
|
||||
<string name="meter">米</string>
|
||||
<string name="activatesAction">触发条件</string>
|
||||
<string name="alertIn">进入</string>
|
||||
<string name="alertOut">离开</string>
|
||||
<string name="alertStated">停留</string>
|
||||
<string name="addFence">添加围栏</string>
|
||||
<string name="removeFence">移除围栏</string>
|
||||
|
||||
<string name="hideOption">隐藏设置</string>
|
||||
<string name="showOption">显示设置</string>
|
||||
|
||||
<string name="showList">显示列表</string>
|
||||
<string name="hideList">隐藏列表</string>
|
||||
|
||||
<string name="fence_round">圆形围栏</string>
|
||||
<string name="fence_polygon">多边形</string>
|
||||
<string name="fence_keyword">关键字围栏</string>
|
||||
<string name="fence_nearby">周边围栏</string>
|
||||
<string name="fence_district">行政区划围栏</string>
|
||||
|
||||
<string name="getLastLocation">获取最后位置</string>
|
||||
|
||||
<string name="startAssistantLocation">启动H5辅助定位</string>
|
||||
<string name="stopAssistantLocation">停止H5辅助定位</string>
|
||||
<string name="urlLocation">浏览器定位</string>
|
||||
<string name="assistantLocationInfo">辅助定位已经启动,请点击模拟浏览器请求或者在浏览器中输入http://127.0.0.1:43689/进行测试</string>
|
||||
|
||||
<string name="coordinateConvert">坐标转换</string>
|
||||
<string name="checkIsChina">位置区域判断</string>
|
||||
|
||||
<string name="notifyTitle">提示</string>
|
||||
<string name="notifyMsg">当前应用缺少必要权限。\n\n请点击\"设置\"-\"权限\"-打开所需权限。</string>
|
||||
<string name="setting">设置</string>
|
||||
<string name="cancel">取消</string>
|
||||
|
||||
<string name="start">开始</string>
|
||||
<string name="stop">停止</string>
|
||||
<string name="locationPurpose">场景定位</string>
|
||||
<string name="locationPurpose_dec">展示根据场景进行定位,设置场景后SDK内部会帮助设置相关属性</string>
|
||||
|
||||
<string name="signIn">签到</string>
|
||||
<string name="signInPurpose">签到场景</string>
|
||||
<string name="signInPurpose_dec">只进行一次定位返回最接近真实位置的定位结果(定位速度可能会延迟1-3s)</string>
|
||||
|
||||
<string name="transportPurpose">出行场景</string>
|
||||
<string name="transportPurpose_dec">高精度连续定位,适用于有户内外切换的场景,GPS和网络定位相互切换,GPS定位成功之后网络定位不再返回,GPS断开之后一段时间才会返回网络结果</string>
|
||||
|
||||
<string name="sportPurpose">运动场景</string>
|
||||
<string name="sportPurpose_dec">高精度连续定位,适用于有户内外切换的场景,GPS和网络定位相互切换,GPS定位成功之后网络定位不再返回,GPS断开之后一段时间才会返回网络结果</string>
|
||||
|
||||
|
||||
<string name="title_locationBackground">GPS位置上报</string>
|
||||
<string name="locationBackground">后台定位</string>
|
||||
<string name="locationBackground_dec">Android 8.0后台定位示例</string>
|
||||
|
||||
<string name="enableBackgroundLocation">开启后台定位</string>
|
||||
<string name="disableBackgroundLocation">关闭后台定位</string>
|
||||
|
||||
<string name="errorCodeInfo">
|
||||
0 定位成功。 可以在定位回调里判断定位返回成功后再进行业务逻辑运算\n
|
||||
1 一些重要参数为空,如context; 请对定位传递的参数进行非空判断\n
|
||||
2 定位失败,由于仅扫描到单个wifi,且没有基站信息。 请重新尝试\n
|
||||
3 获取到的请求参数为空,可能获取过程中出现异常。 请对所连接网络进行全面检查,请求可能被篡改\n
|
||||
4 请求服务器过程中的异常,多为网络情况差,链路不通导致 请检查设备网络是否通畅\n
|
||||
5 返回的XML格式错误,解析失败。 请稍后再试\n
|
||||
6 定位服务返回定位失败。 请将errorDetail(通过getLocationDetail()方法获取)信息通过工单系统反馈给我们\n
|
||||
7 KEY鉴权失败。 请仔细检查key绑定的sha1值与apk签名sha1值是否对应,或通过高频问题查找相关解决办法\n
|
||||
8 Android exception常规错误 请将errordetail(通过getLocationDetail()方法获取)信息通过工单系统反馈给我们\n
|
||||
9 定位初始化时出现异常。 请重新启动定位\n
|
||||
10 定位客户端启动失败。 请检查AndroidManifest.xml文件是否配置了APSService定位服务\n
|
||||
11 定位时的基站信息错误。 请检查是否安装SIM卡,设备很有可能连入了伪基站网络\n
|
||||
12 缺少定位权限。 请在设备的设置中开启app的定位权限\n
|
||||
13 定位失败,由于设备未开启WIFI模块或未插入SIM卡,且GPS当前不可用。 建议开启设备的WIFI模块,并将设备中插入一张可以正常工作的SIM卡,或者检查GPS是否开启;如果以上都内容都确认无误,请您检查App是否被授予定位权限\n
|
||||
14 GPS 定位失败,由于设备当前 GPS 状态差。 建议持设备到相对开阔的露天场所再次尝试\n
|
||||
15 定位结果被模拟导致定位失败。 如果您希望位置被模拟,请通过setMockEnable(true);方法开启允许位置模拟\n
|
||||
16 当前POI检索条件、行政区划检索条件下,无可用地理围栏。 建议调整检索条件后重新尝试,例如调整POI关键字,调整POI类型,调整周边搜区域,调整行政区关键字等\n
|
||||
17 相同的地理围栏已经存在,无需重复添加\n
|
||||
18 飞行模式下关闭了WIFI开关,请关闭飞行模式或者打开WIFI开关\n
|
||||
19 没有检查到SIM卡,并且关闭了WIFI开关,请打开WIFI开关或者插入SIM卡\n
|
||||
</string>
|
||||
|
||||
<string name="locDiagnose_title">定位诊断组件</string>
|
||||
<string name="locDiagnose_desc">演示定位诊断组件</string>
|
||||
<string name="locDiagnose_detail">
|
||||
定位诊断组件,检查定位的必要条件,并给出建议。\n
|
||||
定位诊断组件代码已上传到示例中心,git地址:https://github.com/amap-demo/android-location-diagnose.git
|
||||
</string>
|
||||
<string name = "startDiagnose">开始诊断</string>
|
||||
</resources>
|
||||
16
clientAppOne/app/src/main/res/values/themes.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.ClientAppOne" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/purple_500</item>
|
||||
<item name="colorPrimaryVariant">@color/purple_700</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/teal_200</item>
|
||||
<item name="colorSecondaryVariant">@color/teal_700</item>
|
||||
<item name="colorOnSecondary">@color/black</item>
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
</resources>
|
||||
1
clientAppOne/app/src/test/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
65dffe98-714d-4ef1-8929-7f525eefb578
|
||||
1
clientAppOne/app/src/test/java/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
767b2aed-1101-46ad-a89b-c77e4136d088
|
||||
1
clientAppOne/app/src/test/java/com/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
af13a755-4a56-4a56-8292-318dccbd5042
|
||||
1
clientAppOne/app/src/test/java/com/bmy/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
cc74abec-1a75-4e33-9f28-0db63882fd65
|
||||
@@ -0,0 +1 @@
|
||||
e745332d-55f4-4280-8991-b3cbbdcebeb7
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.bmy.clientappone;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
24
clientAppOne/build.gradle
Normal file
@@ -0,0 +1,24 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath "com.android.tools.build:gradle:4.1.1"
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
19
clientAppOne/gradle.properties
Normal file
@@ -0,0 +1,19 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app"s APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
# Automatically convert third-party libraries to use AndroidX
|
||||
android.enableJetifier=true
|
||||
172
clientAppOne/gradlew
vendored
Executable file
@@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
84
clientAppOne/gradlew.bat
vendored
Normal file
@@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
2
clientAppOne/settings.gradle
Normal file
@@ -0,0 +1,2 @@
|
||||
include ':app'
|
||||
rootProject.name = "clientAppOne"
|
||||
1
clientAppOne/问题.txt
Normal file
@@ -0,0 +1 @@
|
||||
在未开启定位的状态下,放入后台不需要开启后台定位
|
||||