From 7a83b510e976d767418dba76048d6b19fa4de6c9 Mon Sep 17 00:00:00 2001 From: xiaoyan Date: Tue, 7 Nov 2023 15:14:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A0=E5=85=A5=E8=85=BE=E8=AE=AF?= =?UTF-8?q?=E4=BF=A1=E9=B8=BD=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 65 +++-- app/src/main/AndroidManifest.xml | 114 +++++++- .../outdoor/activity/PicturesActivity.java | 7 + .../navinfo/outdoor/api/KeepLiveUtils.java | 55 ++++ .../navinfo/outdoor/api/UserApplication.java | 20 ++ .../outdoor/bean/CommonRequestSend.java | 1 - .../outdoor/fragment/HasSubmitFragment.java | 2 - .../navinfo/outdoor/http/HttpInterface.java | 19 +- .../outdoor/receiver/MessageReceiver.java | 276 ++++++++++++++++++ app/tpns-configs.json | 14 + build.gradle | 52 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 55 ++++ 13 files changed, 618 insertions(+), 64 deletions(-) create mode 100644 app/src/main/java/com/navinfo/outdoor/api/KeepLiveUtils.java create mode 100644 app/src/main/java/com/navinfo/outdoor/receiver/MessageReceiver.java create mode 100644 app/tpns-configs.json diff --git a/app/build.gradle b/app/build.gradle index 778ade9..6113841 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,23 +6,23 @@ plugins { } -sonarqube { - properties { - //Sonar服务器地址 - property "sonar.host.url", "http://10.130.14.162:9000/" - //Token模式 +//sonarqube { +// properties { +// //Sonar服务器地址 +// property "sonar.host.url", "http://10.130.14.162:9000/" +// //Token模式 +//// property "sonar.login","TRD2022" +// //账号密码模式 // property "sonar.login","TRD2022" - //账号密码模式 - property "sonar.login","TRD2022" - property "sonar.password","TRD2022" - property "sonar.sourceEncoding", "UTF-8" - property "sonar.projectKey", "Android_DuoApp" - property "sonar.projectName", project.name - //需要扫描的上传检测代码的模块,可以选择也可以配置哪一些需要或者不需要上传的模块(这里指APP模块下面的java包里面的全部) - property "sonar.sources", "src/main/java" - property "sonar.projectVersion", project.version - } -} +// property "sonar.password","TRD2022" +// property "sonar.sourceEncoding", "UTF-8" +// property "sonar.projectKey", "Android_DuoApp" +// property "sonar.projectName", project.name +// //需要扫描的上传检测代码的模块,可以选择也可以配置哪一些需要或者不需要上传的模块(这里指APP模块下面的java包里面的全部) +// property "sonar.sources", "src/main/java" +// property "sonar.projectVersion", project.version +// } +//} //apply plugin: 'com.android.application' //apply plugin: 'kotlin-android' //apply plugin: 'kotlin-kapt' @@ -45,7 +45,19 @@ android { // 设置支持的SO库架构(开发者可以根据需要,选择一个或多个平台的so) abiFilters "armeabi", "armeabi-v7a", "arm64-v8a" } + + configurations { + cleanedAnnotations + // implementation.exclude group: 'org.jetbrains' , module:'annotations' + implementation.exclude group: 'com.intellij' , module:'annotations' + } + + manifestPlaceholders = [ + XG_ACCESS_ID : "1580017520", + XG_ACCESS_KEY : "ABQZ9Z3PDWXM", + ] } + lintOptions { checkReleaseBuilds false // Or, if you prefer, you can continue to check for errors in release builds, @@ -81,6 +93,10 @@ android { buildFeatures { viewBinding true } +// configurations.all { +// all*.exclude group: "com.squareup.okhttp3", module: "okhttp3" +// all*.exclude group: "com.squareup.okio", module: "okio" +// } } //efs { // //是否对启动过程进程插桩的开关,如果使用自动集成监控则必须开启 @@ -131,11 +147,11 @@ dependencies { implementation 'com.google.code.gson:gson:2.8.5' implementation 'com.readystatesoftware.chuck:library:1.1.0' - //retrofit+rxJava - implementation 'com.squareup.retrofit2:retrofit:2.5.0' - implementation 'com.squareup.retrofit2:converter-gson:2.3.0' - //转换器,请求结果转换成Model - implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0' +// //retrofit+rxJava +// implementation 'com.squareup.retrofit2:retrofit:2.5.0' +// implementation 'com.squareup.retrofit2:converter-gson:2.3.0' +// //转换器,请求结果转换成Model +// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0' //配合RxJava 使用 implementation 'io.reactivex.rxjava2:rxjava:2.2.7' implementation 'io.reactivex.rxjava2:rxandroid:2.1.1' @@ -207,4 +223,11 @@ dependencies { implementation 'com.elvishew:xlog:1.10.1' // // 百度定位 // implementation 'com.baidu.lbsyun:BaiduMapSDK_Location:9.3.7' + // 腾讯推送依赖 + //添加以下依赖 + implementation 'com.tencent.tpns:tpns:1.4.3.1-release' + // 金刚扫描库 + implementation 'com.tencent.jg:jg:1.1' + //推送保活库 + implementation 'com.github.xuexiangjys.XPush:keeplive:1.0.0' } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7bf859e..92bfda8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -3,6 +3,23 @@ xmlns:tools="http://schemas.android.com/tools" package="com.navinfo.outdoor"> + + + + + + + + + + + + + + + @@ -17,10 +34,6 @@ - - - - @@ -36,6 +49,9 @@ + + + @@ -227,6 +243,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java b/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java index 604a860..2d741ed 100644 --- a/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java +++ b/app/src/main/java/com/navinfo/outdoor/activity/PicturesActivity.java @@ -93,6 +93,8 @@ import com.tencent.tencentmap.mapsdk.maps.model.PolylineOptions; import com.tencent.tencentmap.mapsdk.maps.model.TencentMapGestureListener; import com.umeng.commonsdk.internal.crash.UMCrashManager; import com.umeng.umcrash.UMCrash; + +import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.LineString; import org.locationtech.jts.geom.MultiLineString; @@ -684,6 +686,11 @@ public class PicturesActivity extends BaseActivity implements View.OnClickListen for (int i = 0; i < multiLineString.getNumGeometries(); i++) { lineStringList.add((LineString) multiLineString.getGeometryN(i)); } + } + else if ("Point".equals(taskGeometry.getGeometryType())) { + Coordinate pointCoor = taskGeometry.getCoordinate(); + Coordinate pointCoor2 = new Coordinate(pointCoor.x, pointCoor.y+0.00001); + lineStringList.add(GeometryTools.getLineStrinGeo(new Coordinate[]{pointCoor, pointCoor2})); } else { lineStringList.add((LineString) taskGeometry); } diff --git a/app/src/main/java/com/navinfo/outdoor/api/KeepLiveUtils.java b/app/src/main/java/com/navinfo/outdoor/api/KeepLiveUtils.java new file mode 100644 index 0000000..ea11612 --- /dev/null +++ b/app/src/main/java/com/navinfo/outdoor/api/KeepLiveUtils.java @@ -0,0 +1,55 @@ +package com.navinfo.outdoor.api; + +import android.app.Application; +import android.content.Context; +import android.content.Intent; + +import com.github.lazylibrary.util.AppUtils; +import com.navinfo.outdoor.R; +import com.xuexiang.keeplive.KeepLive; +import com.xuexiang.keeplive.config.ForegroundNotification; +import com.xuexiang.keeplive.config.ForegroundNotificationClickListener; +import com.xuexiang.keeplive.config.KeepLiveService; + +public class KeepLiveUtils { + /** + * 初始化保活,配置完成后即可实现程序的保活 + */ + private void initKeepLive(Application application) { + //定义前台服务的默认样式。即标题、描述和图标 + ForegroundNotification notification = new ForegroundNotification("推送服务", "推送服务正在运行中...", R.mipmap.ic_launcher, + //定义前台服务的通知点击事件 + new ForegroundNotificationClickListener() { + @Override + public void onNotificationClick(Context context, Intent intent) { + //可以做一些唤醒程序的操作,这里只是简单地启动了应用 + AppUtils.launchApp(application.getPackageName()); + } + }) + //要想不显示通知,可以设置为false,默认是false + .setIsShow(true); + //启动保活服务 + KeepLive.startWork(application, KeepLive.RunMode.ENERGY, notification, + //你需要保活的服务,如socket连接、定时任务等,建议不用匿名内部类的方式在这里写 + new KeepLiveService() { + /** + * 运行中 + * 由于服务可能会多次自动启动,该方法可能重复调用 + */ + @Override + public void onWorking() { + //可以做一些保活的处理,比如说恢复推送连接等 + } + + /** + * 服务终止 + * 由于服务可能会被多次终止,该方法可能重复调用,需同onWorking配套使用,如注册和注销broadcast + */ + @Override + public void onStop() { + //该回调方法可能会不回调 + } + } + ); + } +} diff --git a/app/src/main/java/com/navinfo/outdoor/api/UserApplication.java b/app/src/main/java/com/navinfo/outdoor/api/UserApplication.java index 0820a79..b841cf3 100644 --- a/app/src/main/java/com/navinfo/outdoor/api/UserApplication.java +++ b/app/src/main/java/com/navinfo/outdoor/api/UserApplication.java @@ -10,6 +10,7 @@ import android.util.Log; import androidx.lifecycle.ProcessLifecycleOwner; +import com.elvishew.xlog.XLog; import com.kongzue.dialogx.DialogX; import com.kongzue.dialogx.style.MIUIStyle; import com.kongzue.dialogx.style.MaterialStyle; @@ -21,6 +22,9 @@ import com.lzy.okgo.cookie.store.DBCookieStore; import com.lzy.okgo.interceptor.HttpLoggingInterceptor; import com.lzy.okgo.model.HttpHeaders; import com.navinfo.outdoor.util.CrashHandler; +import com.tencent.android.tpush.XGIOperateCallback; +import com.tencent.android.tpush.XGPushConfig; +import com.tencent.android.tpush.XGPushManager; import com.tencent.map.navi.TencentNavi; import com.tencent.navi.surport.utils.DeviceUtils; import com.tencent.tencentmap.mapsdk.maps.TencentMapInitializer; @@ -70,6 +74,22 @@ public class UserApplication extends Application { DialogX.init(this); DialogX.globalStyle = new MIUIStyle(); CrashHandler.getInstance().init(); + // 注册腾讯推送 + XGPushConfig.enableDebug(this,true); + XGPushManager.registerPush(this, new XGIOperateCallback() { + @Override + public void onSuccess(Object data, int flag) { + //token在设备卸载重装的时候有可能会变 + Log.d("TPush", "注册成功,设备token为:" + data); + } + + + @Override + public void onFail(Object data, int errCode, String msg) { + Log.d("TPush", "注册失败,错误码:" + errCode + ",错误信息:" + msg); + } + }); + } public static UserApplication getUserApplication() { diff --git a/app/src/main/java/com/navinfo/outdoor/bean/CommonRequestSend.java b/app/src/main/java/com/navinfo/outdoor/bean/CommonRequestSend.java index 2efdb7d..005ebe8 100644 --- a/app/src/main/java/com/navinfo/outdoor/bean/CommonRequestSend.java +++ b/app/src/main/java/com/navinfo/outdoor/bean/CommonRequestSend.java @@ -237,7 +237,6 @@ public class CommonRequestSend { builder.writeTimeout(time, TimeUnit.SECONDS); //全局的连接超时时间 builder.connectTimeout(time, TimeUnit.SECONDS); - builder.callTimeout(time, TimeUnit.SECONDS); OkGo.getInstance().init(UserApplication.getUserApplication()).setOkHttpClient(builder.build()) //全局统一缓存模式,默认不使用缓存,可以不传 .setCacheMode(CacheMode.NO_CACHE) diff --git a/app/src/main/java/com/navinfo/outdoor/fragment/HasSubmitFragment.java b/app/src/main/java/com/navinfo/outdoor/fragment/HasSubmitFragment.java index 3cde25d..075a07d 100644 --- a/app/src/main/java/com/navinfo/outdoor/fragment/HasSubmitFragment.java +++ b/app/src/main/java/com/navinfo/outdoor/fragment/HasSubmitFragment.java @@ -49,8 +49,6 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Objects; -import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; - /** * 记录-已提交 */ diff --git a/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java b/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java index cce0106..fb7cc7d 100644 --- a/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java +++ b/app/src/main/java/com/navinfo/outdoor/http/HttpInterface.java @@ -1,16 +1,17 @@ package com.navinfo.outdoor.http; public class HttpInterface { -// public static final String IP = "http://172.23.138.133:9999/m4";//测试接口-IP -// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-外网 + // 开发 +// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发地址 +// public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/dev/m4";//开发接口-数据上传 -// public static final String IP = "http://120.92.212.218/dtxb/test/m4";//金山云接口地址 -// public static final String IP_UPLOAD = "http://120.131.12.158/dtxb/test/m4";//金山云接口地址-数据上传 - public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//正式环境接口 - public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//正式环境接口 - public static final String IP1 = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试接口-外网 - public static final String IP2 = "http://dtxbmaps.navinfo.com/dtxb/m4";//正式接口 - public static final String IP4 = "http://10.130.23.166/dtxb/jinshan/m4";//心榕给的测试地址 + // 测试 + public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口 + public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/test/m4";//测试环境接口-数据上传 + + // 生产 +// public static final String IP = "http://dtxbmaps.navinfo.com/dtxb/m4";//生产地址 +// public static final String IP_UPLOAD = "http://dtxbmaps.navinfo.com/dtxb/m4";//生产地址-数据上传 public static final String USER_PATH = "/user/";//我的 public static final String MSG_LIST_PATH = "/msgList/";//发现 public static final String USER_LOGIN_PATH = "/userlogin/";//登录 diff --git a/app/src/main/java/com/navinfo/outdoor/receiver/MessageReceiver.java b/app/src/main/java/com/navinfo/outdoor/receiver/MessageReceiver.java new file mode 100644 index 0000000..5ac12bd --- /dev/null +++ b/app/src/main/java/com/navinfo/outdoor/receiver/MessageReceiver.java @@ -0,0 +1,276 @@ +package com.navinfo.outdoor.receiver; + +import android.content.Context; +import android.content.Intent; +import android.util.Log; +import android.widget.Toast; + +import com.elvishew.xlog.XLog; +import com.tencent.android.tpush.NotificationAction; +import com.tencent.android.tpush.XGPushBaseReceiver; +import com.tencent.android.tpush.XGPushClickedResult; +import com.tencent.android.tpush.XGPushRegisterResult; +import com.tencent.android.tpush.XGPushShowedResult; +import com.tencent.android.tpush.XGPushTextMessage; + +import org.json.JSONException; +import org.json.JSONObject; + +public class MessageReceiver extends XGPushBaseReceiver { + public static final String UPDATE_LISTVIEW_ACTION = "com.qq.xgdemo.activity.UPDATE_LISTVIEW"; + public static final String TEST_ACTION = "com.qq.xgdemo.activity.TEST_ACTION"; + public static final String LogTag = "xg.test"; + + /** + * 消息透传处理 + * @param context + * @param message 解析自定义的 JSON + */ + @Override + public void onTextMessage(Context context, XGPushTextMessage message) { + String text = "onTextMessage:" + message.toString(); + // 获取自定义key-value + String customContent = message.getCustomContent(); + if (customContent != null && customContent.length() != 0) { + try { + JSONObject obj = new JSONObject(customContent); + // key1为前台配置的key + if (!obj.isNull("key")) { + String value = obj.getString("key"); + XLog.d("get custom value:" + value); + } + // ... + } catch (JSONException e) { + e.printStackTrace(); + } + } + // APP自主处理消息的过程... + XLog.d(text); + show(context, text); + } + + /** + * 通知展示 + * @param context + * @param notifiShowedRlt 包含通知的内容 + */ + @Override + public void onNotificationShowedResult(Context context, XGPushShowedResult notifiShowedRlt) { + if (context == null || notifiShowedRlt == null) { + return; + } + XLog.d("onNotificationShowedResult:"+notifiShowedRlt.getContent()); +// XGNotification notific = new XGNotification(); +// notific.setMsg_id(notifiShowedRlt.getMsgId()); +// notific.setTitle(notifiShowedRlt.getTitle()); +// notific.setContent(notifiShowedRlt.getContent()); +// // notificationActionType==1为Activity,2为url,3为intent +// notific.setNotificationActionType(notifiShowedRlt +// .getNotificationActionType()); +// // Activity,url,intent都可以通过getActivity()获得 +// notific.setActivity(notifiShowedRlt.getActivity()); +// notific.setUpdate_time(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") +// .format(Calendar.getInstance().getTime())); +// NotificationService.getInstance(context).save(notific); +// +// Intent testIntent = new Intent(TEST_ACTION); +// if (notifiShowedRlt.getTitle().equals(Constants.LOCAL_NOTIFICATION_TITLE)) { +// testIntent.putExtra("step", Constants.TEST_LOCAL_NOTIFICATION); +// } else { +// testIntent.putExtra("step", Constants.TEST_NOTIFICATION); +// } +// context.sendBroadcast(testIntent); +// +// Intent viewIntent = new Intent(UPDATE_LISTVIEW_ACTION); +// context.sendBroadcast(viewIntent); +// show(context, "您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString()); +// XLog.d("您有1条新消息, " + "通知被展示 , " + notifiShowedRlt.toString() + ", PushChannel:" + notifiShowedRlt.getPushChannel()); + } + + /** + * 注册回调 + * @param context + * @param errorCode 0 为成功,其它为错误码 + */ + @Override + public void onRegisterResult(Context context, int errorCode, XGPushRegisterResult message) { + if (context == null || message == null) { + return; + } + String text = ""; + if (errorCode == XGPushBaseReceiver.SUCCESS) { + // 在这里拿token + String token = message.getToken(); + text = "注册成功1. token:" + token; + } else { + text = message + "注册失败,错误码:" + errorCode; + } + XLog.d(text); + show(context, text); + } + + /** + * 反注册回调 + * @param context + * @param errorCode 0 为成功,其它为错误码 + */ + @Override + public void onUnregisterResult(Context context, int errorCode) { + if (context == null) { + return; + } + String text = ""; + if (errorCode == XGPushBaseReceiver.SUCCESS) { + text = "反注册成功"; + } else { + text = "反注册失败" + errorCode; + } + XLog.d(text); + show(context, text); + + } + + /** + * 设置标签回调 + * @param context + * @param errorCode 0 为成功,其它为错误码 + * @param tagName 设置的 TAG + */ + @Override + public void onSetTagResult(Context context, int errorCode, String tagName) { + if (context == null) { + return; + } + String text = ""; + if (errorCode == XGPushBaseReceiver.SUCCESS) { + text = "\"" + tagName + "\"设置成功"; + } else { + text = "\"" + tagName + "\"设置失败,错误码:" + errorCode; + } + XLog.d(text); + show(context, text); + +// Intent testIntent = new Intent(TEST_ACTION); +// testIntent.putExtra("step", Constants.TEST_SET_TAG); +// context.sendBroadcast(testIntent); + } + + /** + * 删除标签的回调 + * @param context + * @param errorCode 0 为成功,其它为错误码 + * @param tagName 设置的 TAG + */ + @Override + public void onDeleteTagResult(Context context, int errorCode, String tagName) { + if (context == null) { + return; + } + String text = ""; + if (errorCode == XGPushBaseReceiver.SUCCESS) { + text = "\"" + tagName + "\"删除成功"; + } else { + text = "\"" + tagName + "\"删除失败,错误码:" + errorCode; + } + XLog.d(text); + show(context, text); + +// Intent testIntent = new Intent(TEST_ACTION); +// testIntent.putExtra("step", Constants.TEST_DEL_TAG); +// context.sendBroadcast(testIntent); + } + + /** + * 设置账号回调 + * @param context + * @param errorCode 0 为成功,其它为错误码 + * @param account 设置的账号 + */ + @Override + public void onSetAccountResult(Context context, int errorCode, String account) { +// Intent testIntent = new Intent(TEST_ACTION); +// testIntent.putExtra("step", Constants.TEST_SET_ACCOUNT); +// context.sendBroadcast(testIntent); + XLog.d("onSetAccountResult:"+errorCode+"-"+account); + show(context, errorCode+":"+account); + } + + + /** + * 删除账号回调 + * @param context + * @param errorCode 0 为成功,其它为错误码 + * @param account 设置的账号 + */ + @Override + public void onDeleteAccountResult(Context context, int errorCode, String account) { +// Intent testIntent = new Intent(TEST_ACTION); +// testIntent.putExtra("step", Constants.TEST_DEL_ACCOUNT); +// context.sendBroadcast(testIntent); + XLog.d("onDeleteAccountResult:"+errorCode+"-"+account); + show(context, errorCode+":"+account); + } + + @Override + public void onSetAttributeResult(Context context, int i, String s) { + + } + + @Override + public void onDeleteAttributeResult(Context context, int i, String s) { + + } + + @Override + public void onQueryTagsResult(Context context, int errorCode, String data, String operateName) { + XLog.i("action - onQueryTagsResult, errorCode:" + errorCode + ", operateName:" + operateName + ", data: " + data); + } + + /** + * 通知点击回调 actionType=1为该消息被清除,actionType=0为该消息被点击 + * @param context + * @param message 包含被点击通知的内容 + */ + @Override + public void onNotificationClickedResult(Context context, XGPushClickedResult message) { + if (context == null || message == null) { + return; + } + String text = ""; + if (message.getActionType() == NotificationAction.clicked.getType()) { + // 通知在通知栏被点击啦。。。。。 + // APP自己处理点击的相关动作 + // 这个动作可以在activity的onResume也能监听,请看第3点相关内容 + text = "通知被打开 :" + message; + } else if (message.getActionType() == NotificationAction.delete.getType()) { + // 通知被清除啦。。。。 + // APP自己处理通知被清除后的相关动作 + text = "通知被清除 :" + message; + } + Toast.makeText(context, "广播接收到通知被点击:" + message.toString(), + Toast.LENGTH_SHORT).show(); + // 获取自定义key-value + String customContent = message.getCustomContent(); + if (customContent != null && customContent.length() != 0) { + try { + JSONObject obj = new JSONObject(customContent); + // key1为前台配置的key + if (!obj.isNull("key")) { + String value = obj.getString("key"); + XLog.d("get custom value:" + value); + } + // ... + } catch (JSONException e) { + e.printStackTrace(); + } + } + // APP自主处理的过程。。。 + XLog.d(text); + show(context, text); + } + + private void show(Context context, String text) { + Toast.makeText(context, text, Toast.LENGTH_SHORT).show(); + } + +} diff --git a/app/tpns-configs.json b/app/tpns-configs.json new file mode 100644 index 0000000..73a8a1a --- /dev/null +++ b/app/tpns-configs.json @@ -0,0 +1,14 @@ +{ + "tpns": { + "access_id": "1580017520", + "access_key": "ABQZ9Z3PDWXM" + }, + "com.navinfo.outdoor": { + "channel": { + "enable": true + } + }, + "debug": true, + "version": "1.4.3.1-release", + "upgrade": true +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index c7f64ce..f49afda 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ buildscript { ext.anko_version = '0.10.1'//扩展库版本 ext.kotlin_version = '1.5.10' repositories { + mavenCentral() //友盟 检测bug //腾讯地图 maven{ @@ -19,7 +20,6 @@ buildscript { //友盟 检测bug maven { url 'https://repo1.maven.org/maven2/' } jcenter() - mavenCentral() google() maven{ url "https://maven.google.com/" @@ -36,31 +36,31 @@ buildscript { } -allprojects { - repositories { - //友盟 检测bug - //腾讯地图 - maven{ - url "https://oss.sonatype.org/content/groups/public" - } - maven { url 'https://repo1.maven.org/maven2/' } - maven{ url 'https://maven.aliyun.com/repository/google'} - maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} - maven{ url 'https://maven.aliyun.com/repository/public'} - maven{ url 'https://maven.aliyun.com/repository/jcenter'} - maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'} - maven { url "https://jitpack.io" } - maven { url "https://repo.spring.io/libs-release/" } - //友盟 检测bug - maven { url 'https://repo1.maven.org/maven2/' } - jcenter() - mavenCentral() - google() - maven{ - url "https://maven.google.com/" - } - } -} +//allprojects { +// repositories { +// mavenCentral() +// //友盟 检测bug +// //腾讯地图 +// maven{ +// url "https://oss.sonatype.org/content/groups/public" +// } +// maven { url 'https://repo1.maven.org/maven2/' } +// maven{ url 'https://maven.aliyun.com/repository/google'} +// maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} +// maven{ url 'https://maven.aliyun.com/repository/public'} +// maven{ url 'https://maven.aliyun.com/repository/jcenter'} +// maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'} +// maven { url "https://jitpack.io" } +// maven { url "https://repo.spring.io/libs-release/" } +// //友盟 检测bug +// maven { url 'https://repo1.maven.org/maven2/' } +// jcenter() +// google() +// maven{ +// url "https://maven.google.com/" +// } +// } +//} task clean(type: Delete) { delete rootProject.buildDir diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fb492cc..3282f3d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Jul 18 13:25:30 CST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index 8e5d0a4..70f7016 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,56 @@ +pluginManagement { + repositories { + mavenCentral() + //友盟 检测bug + //腾讯地图 + maven{ + url "https://oss.sonatype.org/content/groups/public" + } + maven { url 'https://repo1.maven.org/maven2/' } + maven{ url 'https://maven.aliyun.com/repository/google'} + maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} + maven{ url 'https://maven.aliyun.com/repository/public'} + maven{ url 'https://maven.aliyun.com/repository/jcenter'} + maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'} + maven { url "https://jitpack.io" } + maven { url "https://repo.spring.io/libs-release/" } + //友盟 检测bug + maven { url 'https://repo1.maven.org/maven2/' } + jcenter() + google() + maven{ + url "https://maven.google.com/" + } + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + mavenCentral() + //友盟 检测bug + //腾讯地图 + maven{ + url "https://oss.sonatype.org/content/groups/public" + } + maven { url 'https://repo1.maven.org/maven2/' } + maven{ url 'https://maven.aliyun.com/repository/google'} + maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} + maven{ url 'https://maven.aliyun.com/repository/public'} + maven{ url 'https://maven.aliyun.com/repository/jcenter'} + maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'} + maven { url "https://jitpack.io" } + maven { url "https://repo.spring.io/libs-release/" } + //友盟 检测bug + maven { url 'https://repo1.maven.org/maven2/' } + jcenter() + google() + maven{ + url "https://maven.google.com/" + } + gradlePluginPortal() + + } +} +rootProject.name = "NavinfoOutDoor" include ':app', ':xrecyclerview', ":ocr" \ No newline at end of file