add new module of location and update version

This commit is contained in:
zhongchao
2021-07-09 09:34:23 +08:00
parent 7389428f57
commit 7a8437ad20
16 changed files with 244 additions and 12 deletions

1
.idea/gradle.xml generated
View File

@@ -15,6 +15,7 @@
<option value="$PROJECT_DIR$/foudations" /> <option value="$PROJECT_DIR$/foudations" />
<option value="$PROJECT_DIR$/foudations/mogo-httpdns" /> <option value="$PROJECT_DIR$/foudations/mogo-httpdns" />
<option value="$PROJECT_DIR$/foudations/mogo-live" /> <option value="$PROJECT_DIR$/foudations/mogo-live" />
<option value="$PROJECT_DIR$/foudations/mogo-location" />
<option value="$PROJECT_DIR$/foudations/mogo-network" /> <option value="$PROJECT_DIR$/foudations/mogo-network" />
<option value="$PROJECT_DIR$/foudations/mogo-passport" /> <option value="$PROJECT_DIR$/foudations/mogo-passport" />
<option value="$PROJECT_DIR$/foudations/mogo-socket" /> <option value="$PROJECT_DIR$/foudations/mogo-socket" />

1
foudations/mogo-location/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,41 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode 1
versionName "${MOGO_LOCATION_VERSION}"
consumerProguardFiles "consumer-rules.pro"
}
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 fileTree(dir: "libs", include: ["*.jar"])
// 上报位置
implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.7'
api rootProject.ext.dependencies.spi
if (Boolean.valueOf(RELEASE)) {
implementation "com.mogo.cloud:passport:${MOGO_PASSPORT_VERSION}"
} else {
implementation project(path: ':foudations:mogo-passport')
}
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -0,0 +1,4 @@
GROUP=com.mogo.cloud
POM_ARTIFACT_ID=location
VERSION_CODE=1
VERSION_NAME=1.0.0-SNAPSHOT

View 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

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.cloud.location">
</manifest>

View File

@@ -0,0 +1,20 @@
package com.mogo.cloud.location;
import android.content.Context;
/**
* 位置服务:上报位置信息和车机状态
*/
public interface IMogoLocationInfoService {
/**
* 初始化
*
* @param context 上下文
*/
void init(Context context);
void start();
void stop();
}

View File

@@ -0,0 +1,56 @@
package com.mogo.cloud.location;
import android.content.Context;
import com.mogo.cloud.location.internal.InternalLocationManager;
import com.mogo.cloud.location.third.ThirdLocationManager;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
public class LocationManager implements IMogoLocationInfoService {
private static volatile LocationManager mInstance;
private MoGoAiCloudClientConfig cloudClientConfig;
private LocationManager() {
cloudClientConfig = MoGoAiCloudClient.getInstance().getAiCloudClientConfig();
}
public static LocationManager getInstance() {
if (mInstance == null) {
synchronized (LocationManager.class) {
if (mInstance == null) {
mInstance = new LocationManager();
}
}
}
return mInstance;
}
@Override
public void init(Context context) {
if (cloudClientConfig.isThirdLogin()) {
ThirdLocationManager.getInstance().init(context);
} else {
InternalLocationManager.getInstance().init(context);
}
}
@Override
public void start() {
if (cloudClientConfig.isThirdLogin()) {
ThirdLocationManager.getInstance().start();
} else {
InternalLocationManager.getInstance().start();
}
}
@Override
public void stop() {
if (cloudClientConfig.isThirdLogin()) {
ThirdLocationManager.getInstance().stop();
} else {
InternalLocationManager.getInstance().stop();
}
}
}

View File

@@ -0,0 +1,31 @@
package com.mogo.cloud.location.internal;
import android.content.Context;
public class InternalLocationManager {
private static volatile InternalLocationManager mInstance;
public static InternalLocationManager getInstance() {
if (mInstance == null) {
synchronized (InternalLocationManager.class) {
if (mInstance == null) {
mInstance = new InternalLocationManager();
}
}
}
return mInstance;
}
public void init(Context context) {
}
public void start() {
}
public void stop() {
}
}

View File

@@ -0,0 +1,50 @@
package com.mogo.cloud.location.third;
import android.content.Context;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.cloud.utils.logger.Logger;
import com.zhidao.locupload.LocUploadConfig;
import com.zhidao.locupload.LocUploadManager;
public class ThirdLocationManager {
private static final String TAG = "ThirdLocationManager";
private static volatile ThirdLocationManager mInstance;
private MoGoAiCloudClientConfig cloudClientConfig;
private ThirdLocationManager() {
cloudClientConfig = MoGoAiCloudClient.getInstance().getAiCloudClientConfig();
}
public static ThirdLocationManager getInstance() {
if (mInstance == null) {
synchronized (ThirdLocationManager.class) {
if (mInstance == null) {
mInstance = new ThirdLocationManager();
}
}
}
return mInstance;
}
public void init(Context context) {
LocUploadConfig.instance().
setAppId(cloudClientConfig.getServiceAppId()).
setContext(context.getApplicationContext()).
setLoggable(cloudClientConfig.isShowDebugLog()).
setLocInterval(2000L);
Logger.d(TAG, "location sdk - init");
}
public void start() {
LocUploadManager.getInstance().startUpload();
Logger.d( TAG, "sdk - start" );
}
public void stop() {
LocUploadManager.getInstance().stopUpload();
Logger.d( TAG, "sdk - stop" );
}
}

View File

@@ -41,7 +41,6 @@ dependencies {
implementation project(path: ':foudations:mogo-passport') implementation project(path: ':foudations:mogo-passport')
} }
} }
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString() apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -8,7 +8,7 @@ android {
targetSdkVersion rootProject.ext.android.targetSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode 1 versionCode 1
versionName "${MOGO_LIVE_VERSION}" versionName "${MOGO_UTILS_VERSION}"
consumerProguardFiles "consumer-rules.pro" consumerProguardFiles "consumer-rules.pro"
} }

View File

@@ -30,20 +30,22 @@ PASSWORD=xintai2018
RELEASE=true RELEASE=true
# AI CLOUD 云平台 # AI CLOUD 云平台
# 工具类 # 工具类
MOGO_UTILS_VERSION=1.1.18 MOGO_UTILS_VERSION=1.1.21
# 网络请求 # 网络请求
MOGO_NETWORK_VERSION=1.1.18 MOGO_NETWORK_VERSION=1.1.21
# 网络DNS # 网络DNS
MOGO_HTTPDNS_VERSION=1.1.18 MOGO_HTTPDNS_VERSION=1.1.21
# 鉴权 # 鉴权
MOGO_PASSPORT_VERSION=1.1.18 MOGO_PASSPORT_VERSION=1.1.21
# 常链接 # 常链接
MOGO_SOCKET_VERSION=1.1.18 MOGO_SOCKET_VERSION=1.1.21
# 数据采集 # 数据采集
MOGO_REALTIME_VERSION=1.1.18 MOGO_REALTIME_VERSION=1.1.21
# 探路,道路事件发布,获取 # 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.1.18 MOGO_TANLU_VERSION=1.1.21
# 直播推流 # 直播推流
MOGO_LIVE_VERSION=1.1.18 MOGO_LIVE_VERSION=1.1.21
# 直播拉流 # 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.1.18 MOGO_TRAFFICLIVE_VERSION=1.1.21
# 定位服务
MOGO_LOCATION_VERSION=1.1.21

View File

@@ -8,7 +8,7 @@ android {
targetSdkVersion rootProject.ext.android.targetSdkVersion targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode 1 versionCode 1
versionName "${MOGO_SOCKET_VERSION}" versionName "${MOGO_REALTIME_VERSION}"
consumerProguardFiles "consumer-rules.pro" consumerProguardFiles "consumer-rules.pro"
} }

View File

@@ -1,3 +1,4 @@
include ':foudations:mogo-location'
include ':modules:mogo-trafficlive' include ':modules:mogo-trafficlive'
include ':foudations:mogo-utils' include ':foudations:mogo-utils'
include ':foudations:mogo-live' include ':foudations:mogo-live'