添加探路api接口实现
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.zhidao.mogo.tanlu.api;
|
||||
|
||||
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.zhidao.mogo.tanlu.api.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
5
libraries/mogo-tanlu-api/src/main/AndroidManifest.xml
Normal file
5
libraries/mogo-tanlu-api/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.tanlu.api">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.zhidao.mogo.tanlu.api;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.service.tanlu.IMogoTanluProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.roadcondition.service.MainService;
|
||||
|
||||
import static com.zhidao.mogo.tanlu.api.TanluApiConst.MODULE_NAME;
|
||||
import static com.zhidao.mogo.tanlu.api.TanluApiConst.MODULE_PATH;
|
||||
|
||||
/**
|
||||
* 探路api
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
@Route(path = MODULE_PATH)
|
||||
public class MogoTanluApiProvider implements IMogoTanluProvider {
|
||||
private Context context;
|
||||
/**
|
||||
* 上传情报
|
||||
*
|
||||
* @param type 情报类型
|
||||
*/
|
||||
@Override
|
||||
public void uploadRoadCondition(String type) {
|
||||
Logger.d(MODULE_NAME, "uploadRoadCondition: " + type);
|
||||
MainService.Companion.launchService(context, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启探路业务服务
|
||||
*/
|
||||
@Override
|
||||
public void startTanluService() {
|
||||
Logger.d(MODULE_NAME, "startTanluService");
|
||||
MainService.Companion.launchService(context, "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.zhidao.mogo.tanlu.api;
|
||||
|
||||
/**
|
||||
* 探路api相关常量
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class TanluApiConst {
|
||||
public static final String MODULE_NAME = "MogoTanluApi";
|
||||
public static final String MODULE_PATH = "/tanlulib/api";
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.zhidao.mogo.tanlu.api;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user