opt
This commit is contained in:
@@ -99,25 +99,25 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
prepareBaseService();
|
||||
prepareBaseService(2_000L);
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础服务:passport、location、socket
|
||||
*/
|
||||
private void prepareBaseService(){
|
||||
UiThreadHandler.postDelayed( ()->{
|
||||
private void prepareBaseService(long delay) {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
// 第三方平台的sn是服务端生成的,所以必须在返回后才能开启
|
||||
if ( TextUtils.isEmpty( Utils.getSn() ) ) {
|
||||
preparePassportEnvironment( apis, ()->{
|
||||
preparePassportEnvironment( apis, () -> {
|
||||
prepareSocketAndLocationServices( apis );
|
||||
} );
|
||||
} else {
|
||||
preparePassportEnvironment( apis, null );
|
||||
prepareSocketAndLocationServices( apis );
|
||||
}
|
||||
}, 2_000L );
|
||||
}, delay );
|
||||
}
|
||||
|
||||
private void preparePassportEnvironment( IMogoServiceApis apis, Runnable after ) {
|
||||
@@ -138,12 +138,14 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
} else {
|
||||
prepareBaseService(1_000L);
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private void prepareSocketAndLocationServices(IMogoServiceApis apis){
|
||||
private void prepareSocketAndLocationServices( IMogoServiceApis apis ) {
|
||||
apis.getSocketManagerApi( getApplicationContext() ).init( getApplicationContext(), DebugConfig.getSocketAppId() );
|
||||
apis.getLocationInfoApi().start();
|
||||
apis.getMapServiceApi().getSingletonLocationClient( getApplicationContext() ).addLocationListener( location -> {
|
||||
|
||||
Reference in New Issue
Block a user