添加uc接入代码
This commit is contained in:
parent
b2e58d4462
commit
f8c016c722
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.hnjc.wjtx.mi"
|
applicationId "com.hnjc.wjtx.aligames"
|
||||||
minSdkVersion 18
|
minSdkVersion 18
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 1
|
versionCode 1
|
||||||
@ -39,4 +39,6 @@ dependencies {
|
|||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
implementation 'com.android.volley:volley:1.1.1'
|
implementation 'com.android.volley:volley:1.1.1'
|
||||||
implementation 'org.greenrobot:eventbus:3.2.0'
|
implementation 'org.greenrobot:eventbus:3.2.0'
|
||||||
|
implementation 'com.jakewharton:butterknife:8.2.1'
|
||||||
|
annotationProcessor('com.jakewharton:butterknife-compiler:8.2.1')
|
||||||
}
|
}
|
||||||
|
BIN
app/libs/alipaySdk-15.6.4-20190611174341.aar
Normal file
BIN
app/libs/alipaySdk-15.6.4-20190611174341.aar
Normal file
Binary file not shown.
BIN
app/libs/net-sdk-9.2.4.4.aar
Normal file
BIN
app/libs/net-sdk-9.2.4.4.aar
Normal file
Binary file not shown.
BIN
app/libs/ugpsdk-net-7.6.3.1.aar
Normal file
BIN
app/libs/ugpsdk-net-7.6.3.1.aar
Normal file
Binary file not shown.
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
@ -83,7 +83,7 @@
|
|||||||
-dontwarn android.support.**
|
-dontwarn android.support.**
|
||||||
-keep class **.R$styleable{*;}
|
-keep class **.R$styleable{*;}
|
||||||
|
|
||||||
-keep class com.hnjc.wjtx.mi.** { *; }
|
-keep class com.hnjc.wjtx.aligames.** { *; }
|
||||||
-dontwarn com.hnjc.wjtx.mi.**
|
-dontwarn com.hnjc.wjtx.mi.**
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.hnjc.wjtx">
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
package="com.hnjc.wjtx.aligames">
|
||||||
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<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_EXTERNAL_STORAGE" />
|
||||||
@ -10,8 +12,16 @@
|
|||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
|
<supports-screens
|
||||||
|
android:anyDensity="true"
|
||||||
|
android:largeScreens="true"
|
||||||
|
android:normalScreens="true"
|
||||||
|
android:resizeable="true"
|
||||||
|
android:smallScreens="true" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
|
tools:replace="android:allowBackup"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:name=".JCApplication"
|
android:name=".JCApplication"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
@ -38,19 +48,45 @@
|
|||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
<!-- 增加app拉起相关cn.uc.gamesdk.activity.PullupActivity的声明 -->
|
||||||
|
<activity
|
||||||
|
android:name="cn.uc.gamesdk.activity.PullupActivity"
|
||||||
|
android:theme="@android:style/Theme.Translucent"
|
||||||
|
android:taskAffinity="com.hnjc.wjtx.aligames.diff"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
|
android:label="PullupActivity"
|
||||||
|
android:launchMode="singleTop"
|
||||||
|
android:exported="true"
|
||||||
|
tools:node="replace">
|
||||||
|
|
||||||
<!-- <activity android:name=".MainActivity"-->
|
<intent-filter>
|
||||||
<!-- android:launchMode="singleTask"-->
|
<action android:name="android.intent.action.VIEW"/>
|
||||||
<!-- android:screenOrientation="portrait"-->
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<!-- android:windowSoftInputMode="adjustPan|stateAlwaysVisible"-->
|
<category android:name="android.intent.category.BROWSABLE"/>
|
||||||
<!-- android:configChanges="orientation|keyboardHidden|screenSize|screenLayout"-->
|
<data android:scheme="ng119474" />
|
||||||
<!-- android:theme="@android:style/Theme.NoTitleBar.Fullscreen">-->
|
</intent-filter>
|
||||||
<!-- <intent-filter>-->
|
</activity>
|
||||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
|
||||||
|
<activity
|
||||||
|
android:name="cn.gundam.sdk.shell.activity.ProxyActivity"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||||
|
android:windowSoftInputMode="adjustResize" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="cn.uc.gamesdk.sdkweb" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<!-- sdk service -->
|
||||||
|
<service
|
||||||
|
android:name="cn.gundam.sdk.shell.service.ProxyService"
|
||||||
|
android:exported="true"
|
||||||
|
android:process=":bgservice" />
|
||||||
|
<!-- sdk service end -->
|
||||||
|
|
||||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
|
||||||
<!-- </intent-filter>-->
|
|
||||||
<!-- </activity>-->
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
package com.hnjc.wjtx;
|
|
||||||
|
|
||||||
import android.app.Application;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class JCApplication extends Application {
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
Log.i("JCApplication", "JCApplication onCreate");
|
|
||||||
}
|
|
||||||
}
|
|
18
app/src/main/java/com/hnjc/wjtx/aligames/JCApplication.java
Normal file
18
app/src/main/java/com/hnjc/wjtx/aligames/JCApplication.java
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package com.hnjc.wjtx.aligames;
|
||||||
|
|
||||||
|
import android.app.Application;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import cn.uc.gamesdk.SDKHelper;
|
||||||
|
|
||||||
|
public class JCApplication extends Application {
|
||||||
|
@Override
|
||||||
|
public void onCreate() {
|
||||||
|
Log.i("JCApplication", "JCApplication onCreate");
|
||||||
|
if(!SDKHelper.isBackground(this)){
|
||||||
|
//调用super方法
|
||||||
|
super.onCreate();
|
||||||
|
//表示当前为SDK所属的子进程,不应该再执行其他游戏相关的初始化
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx;
|
package com.hnjc.wjtx.aligames;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
@ -12,12 +12,12 @@ import android.util.Log;
|
|||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.hnjc.wjtx.net.DownloadRunnable;
|
import com.hnjc.wjtx.aligames.net.DownloadRunnable;
|
||||||
import com.hnjc.wjtx.net.TaskInfo;
|
import com.hnjc.wjtx.aligames.net.TaskInfo;
|
||||||
import com.hnjc.wjtx.net.WebApi;
|
import com.hnjc.wjtx.aligames.net.WebApi;
|
||||||
import com.hnjc.wjtx.util.AssetsUtil;
|
import com.hnjc.wjtx.aligames.util.AssetsUtil;
|
||||||
import com.hnjc.wjtx.util.StringUtil;
|
import com.hnjc.wjtx.aligames.util.StringUtil;
|
||||||
import com.hnjc.wjtx.util.UnzipRunnable;
|
import com.hnjc.wjtx.aligames.util.UnzipRunnable;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
@ -1,8 +1,8 @@
|
|||||||
package com.hnjc.wjtx;
|
package com.hnjc.wjtx.aligames;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@ -16,15 +16,25 @@ import android.widget.FrameLayout;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.hnjc.wjtx.util.AssetsUtil;
|
import com.hnjc.wjtx.aligames.util.AssetsUtil;
|
||||||
import com.hnjc.wjtx.util.IdUtil;
|
import com.hnjc.wjtx.aligames.util.StorageUtil;
|
||||||
import com.hnjc.wjtx.util.StorageUtil;
|
import com.hnjc.wjtx.aligames.util.StringUtil;
|
||||||
import com.hnjc.wjtx.util.StringUtil;
|
|
||||||
|
|
||||||
import org.egret.egretnativeandroid.EgretNativeAndroid;
|
import org.egret.egretnativeandroid.EgretNativeAndroid;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import cn.gundam.sdk.shell.even.SDKEventKey;
|
||||||
|
import cn.gundam.sdk.shell.even.SDKEventReceiver;
|
||||||
|
import cn.gundam.sdk.shell.even.Subscribe;
|
||||||
|
import cn.gundam.sdk.shell.exception.AliLackActivityException;
|
||||||
|
import cn.gundam.sdk.shell.exception.AliNotInitException;
|
||||||
|
import cn.gundam.sdk.shell.open.ParamInfo;
|
||||||
|
import cn.gundam.sdk.shell.open.UCOrientation;
|
||||||
|
import cn.gundam.sdk.shell.param.SDKParamKey;
|
||||||
|
import cn.gundam.sdk.shell.param.SDKParams;
|
||||||
|
import cn.uc.gamesdk.UCGameSdk;
|
||||||
|
|
||||||
//Android项目发布设置详见doc目录下的README_ANDROID.md
|
//Android项目发布设置详见doc目录下的README_ANDROID.md
|
||||||
|
|
||||||
public class MainActivity extends Activity {
|
public class MainActivity extends Activity {
|
||||||
@ -40,7 +50,7 @@ public class MainActivity extends Activity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
String preloadPath = AssetsUtil.getDiskFileDir(this, this.getString(R.string.preload_path));
|
String preloadPath = AssetsUtil.getDiskFileDir(this, this.getString(R.string.preload_path));
|
||||||
String gameUrl = this.getString(R.string.game_url);
|
|
||||||
|
|
||||||
nativeAndroid = new EgretNativeAndroid(this);
|
nativeAndroid = new EgretNativeAndroid(this);
|
||||||
if (!nativeAndroid.checkGlEsVersion()) {
|
if (!nativeAndroid.checkGlEsVersion()) {
|
||||||
@ -59,7 +69,7 @@ public class MainActivity extends Activity {
|
|||||||
nativeAndroid.config.preloadPath = preloadPath;
|
nativeAndroid.config.preloadPath = preloadPath;
|
||||||
|
|
||||||
setExternalInterfaces();
|
setExternalInterfaces();
|
||||||
|
String gameUrl = this.getString(R.string.game_url);
|
||||||
if (!nativeAndroid.initialize(gameUrl)) {
|
if (!nativeAndroid.initialize(gameUrl)) {
|
||||||
Toast.makeText(this, "Initialize native failed.",
|
Toast.makeText(this, "Initialize native failed.",
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
@ -67,10 +77,19 @@ public class MainActivity extends Activity {
|
|||||||
}
|
}
|
||||||
setContentView(nativeAndroid.getRootFrameLayout());
|
setContentView(nativeAndroid.getRootFrameLayout());
|
||||||
rootLayout = nativeAndroid.getRootFrameLayout();
|
rootLayout = nativeAndroid.getRootFrameLayout();
|
||||||
|
nativeAndroid.pause();
|
||||||
showLoadingView();
|
showLoadingView();
|
||||||
vibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE);
|
vibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
ucNetworkAndInitUCGameSDK();
|
||||||
|
UCGameSdk.defaultSdk().registerSDKEventReceiver(receiver);
|
||||||
|
}
|
||||||
|
public void startGame() {
|
||||||
|
nativeAndroid.resume();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
ucNetworkAndInitUCGameSDK();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
@ -86,19 +105,11 @@ public class MainActivity extends Activity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onKeyDown(final int keyCode, final KeyEvent keyEvent) {
|
public boolean onKeyDown(final int keyCode, final KeyEvent keyEvent) {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
//声明并初始化弹出对象
|
try {
|
||||||
AlertDialog.Builder builder=new AlertDialog.Builder(this);
|
UCGameSdk.defaultSdk().exit(this, null);
|
||||||
builder.setTitle("提示:");
|
} catch (Exception e) {
|
||||||
builder.setMessage("是否退出");
|
e.printStackTrace();
|
||||||
//设置确认按钮
|
}
|
||||||
builder.setNegativeButton("确定", (dialog, which) -> {
|
|
||||||
nativeAndroid.exitGame();
|
|
||||||
finish();//退出程序
|
|
||||||
});
|
|
||||||
//设置取消按钮
|
|
||||||
builder.setPositiveButton("取消",null);
|
|
||||||
//显示弹框
|
|
||||||
builder.show();
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return super.onKeyDown(keyCode, keyEvent);
|
return super.onKeyDown(keyCode, keyEvent);
|
||||||
@ -163,18 +174,7 @@ public class MainActivity extends Activity {
|
|||||||
Toast.makeText(MainActivity.this, message, Toast.LENGTH_LONG).show();
|
Toast.makeText(MainActivity.this, message, Toast.LENGTH_LONG).show();
|
||||||
});
|
});
|
||||||
nativeAndroid.setExternalInterface("getUid", message -> {
|
nativeAndroid.setExternalInterface("getUid", message -> {
|
||||||
//TODO: 平台的登陆
|
ucSdkLogin();
|
||||||
JSONObject obj = new JSONObject();
|
|
||||||
try {
|
|
||||||
obj.put("openid", IdUtil.getUid(this));
|
|
||||||
obj.put("token", "");
|
|
||||||
// 如果其他登陆过程中的错误, 则传入一个大于0的errorcode
|
|
||||||
obj.put("errorcode", 1);
|
|
||||||
nativeAndroid.callExternalInterface("sendUidToJS", obj.toString());
|
|
||||||
} catch (JSONException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
nativeAndroid.callExternalInterface("loginCancel", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
nativeAndroid.setExternalInterface("@onState", message -> {
|
nativeAndroid.setExternalInterface("@onState", message -> {
|
||||||
@ -266,4 +266,111 @@ public class MainActivity extends Activity {
|
|||||||
launchScreenImageView = null;
|
launchScreenImageView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ucNetworkAndInitUCGameSDK() {
|
||||||
|
//!!!在调用SDK初始化前进行网络检查
|
||||||
|
//当前没有拥有网络
|
||||||
|
ucSdkInit();//执行UCGameSDK初始化
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ucSdkInit() {
|
||||||
|
ParamInfo gameParamInfo = new ParamInfo();
|
||||||
|
|
||||||
|
gameParamInfo.setGameId(UCSdkConfig.gameId);
|
||||||
|
|
||||||
|
gameParamInfo.setOrientation(UCOrientation.PORTRAIT);
|
||||||
|
|
||||||
|
SDKParams sdkParams = new SDKParams();
|
||||||
|
sdkParams.put(SDKParamKey.GAME_PARAMS, gameParamInfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
UCGameSdk.defaultSdk().initSdk(this, sdkParams);
|
||||||
|
} catch (AliLackActivityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ucSdkLogin() {
|
||||||
|
try {
|
||||||
|
UCGameSdk.defaultSdk().login(this, null);
|
||||||
|
} catch (AliLackActivityException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (AliNotInitException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ucSdkPay() {
|
||||||
|
// Intent intent = new Intent(MainActivity.this, GamePayActivity.class);
|
||||||
|
// MainActivity.this.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDKEventReceiver receiver = new SDKEventReceiver() {
|
||||||
|
@Subscribe(event = SDKEventKey.ON_INIT_SUCC)
|
||||||
|
private void onInitSucc() {
|
||||||
|
|
||||||
|
startGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_INIT_FAILED)
|
||||||
|
private void onInitFailed(String data) {
|
||||||
|
//初始化失败
|
||||||
|
Toast.makeText(MainActivity.this, "init failed", Toast.LENGTH_SHORT).show();
|
||||||
|
Log.i(TAG, "UC SDK init failed");
|
||||||
|
ucNetworkAndInitUCGameSDK();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_LOGIN_SUCC)
|
||||||
|
private void onLoginSucc(String sid) {
|
||||||
|
JSONObject obj = new JSONObject();
|
||||||
|
try {
|
||||||
|
obj.put("openid", sid);
|
||||||
|
obj.put("token", "");
|
||||||
|
nativeAndroid.callExternalInterface("sendUidToJS", obj.toString());
|
||||||
|
} catch (JSONException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
nativeAndroid.callExternalInterface("loginCancel", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_LOGIN_FAILED)
|
||||||
|
private void onLoginFailed(String desc) {
|
||||||
|
nativeAndroid.callExternalInterface("loginCancel", desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_LOGOUT_SUCC)
|
||||||
|
private void onLogoutSucc() {
|
||||||
|
nativeAndroid.callExternalInterface("loginOut", "");
|
||||||
|
// AccountInfo.instance().setSid("");
|
||||||
|
ucSdkLogin();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_LOGOUT_FAILED)
|
||||||
|
private void onLogoutFailed() {
|
||||||
|
Toast.makeText(MainActivity.this, "logout failed", Toast.LENGTH_SHORT).show();
|
||||||
|
// printMsg("注销失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_EXIT_SUCC)
|
||||||
|
private void onExit(String desc) {
|
||||||
|
nativeAndroid.exitGame();
|
||||||
|
finish();//退出程序
|
||||||
|
|
||||||
|
// // 退出程序
|
||||||
|
// Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
|
// intent.addCategory(Intent.CATEGORY_HOME);
|
||||||
|
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
// startActivity(intent);
|
||||||
|
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
|
// printMsg(desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(event = SDKEventKey.ON_EXIT_CANCELED)
|
||||||
|
private void onExitCanceled(String desc) {
|
||||||
|
Toast.makeText(MainActivity.this, desc, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
14
app/src/main/java/com/hnjc/wjtx/aligames/UCSdkConfig.java
Normal file
14
app/src/main/java/com/hnjc/wjtx/aligames/UCSdkConfig.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.hnjc.wjtx.aligames;
|
||||||
|
|
||||||
|
public class UCSdkConfig {
|
||||||
|
// 以下参数仅供测试。在正式集成SDK时,需要使用正式的id数据。
|
||||||
|
// 游戏开发人员需要跟自己的商务或运营人员联系获取。
|
||||||
|
|
||||||
|
|
||||||
|
public static final int gameId = 1179479;
|
||||||
|
|
||||||
|
public static final String sign_key = "bf4dcf740ca7cd6f0980e4d8fa7f77b0";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import com.android.volley.AuthFailureError;
|
import com.android.volley.AuthFailureError;
|
||||||
import com.android.volley.NetworkResponse;
|
import com.android.volley.NetworkResponse;
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
public class BaseMode {
|
public class BaseMode {
|
||||||
private boolean status;
|
private boolean status;
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
public class RequestErrorEvent {
|
public class RequestErrorEvent {
|
||||||
private int type;
|
private int type;
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
public class TaskInfo {
|
public class TaskInfo {
|
||||||
private String name;//文件名
|
private String name;//文件名
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.net;
|
package com.hnjc.wjtx.aligames.net;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@ -20,7 +20,7 @@ public class IdUtil {
|
|||||||
while (enumeration.hasMoreElements()) {
|
while (enumeration.hasMoreElements()) {
|
||||||
NetworkInterface netInterface = enumeration.nextElement();
|
NetworkInterface netInterface = enumeration.nextElement();
|
||||||
if (netInterface.getName().equals("wlan0")) {
|
if (netInterface.getName().equals("wlan0")) {
|
||||||
return com.hnjc.wjtx.util.StringUtil.getMD5(netInterface.getHardwareAddress().toString(), false);
|
return com.hnjc.wjtx.aligames.util.StringUtil.getMD5(netInterface.getHardwareAddress().toString(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -59,9 +59,9 @@ public class IdUtil {
|
|||||||
ContentResolver resolver = context.getContentResolver();
|
ContentResolver resolver = context.getContentResolver();
|
||||||
String wifiMac = getWifiMac();
|
String wifiMac = getWifiMac();
|
||||||
String androidId = getAndroidId(resolver);
|
String androidId = getAndroidId(resolver);
|
||||||
if (com.hnjc.wjtx.util.StringUtil.notBlank(androidId)) {
|
if (com.hnjc.wjtx.aligames.util.StringUtil.notBlank(androidId)) {
|
||||||
return androidId;
|
return androidId;
|
||||||
} else if (com.hnjc.wjtx.util.StringUtil.notBlank(wifiMac)) {
|
} else if (com.hnjc.wjtx.aligames.util.StringUtil.notBlank(wifiMac)) {
|
||||||
return wifiMac;
|
return wifiMac;
|
||||||
} else {
|
} else {
|
||||||
return getUniquePsuedoID();
|
return getUniquePsuedoID();
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package com.hnjc.wjtx.util;
|
package com.hnjc.wjtx.aligames.util;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.hnjc.wjtx.net.TaskInfo;
|
import com.hnjc.wjtx.aligames.net.TaskInfo;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.BufferedOutputStream;
|
import java.io.BufferedOutputStream;
|
@ -3,7 +3,7 @@
|
|||||||
<string name="load_game">下载游戏资源</string>
|
<string name="load_game">下载游戏资源</string>
|
||||||
<string name="start_game">进入游戏</string>
|
<string name="start_game">进入游戏</string>
|
||||||
<string name="preload_path">preload</string>
|
<string name="preload_path">preload</string>
|
||||||
<string name="game_url">http://local/index.html?channel=7103</string>
|
<string name="game_url">http://local/index.html?channel=7110</string>
|
||||||
<string name="local_version">1.0.0</string>
|
<string name="local_version">1.0.0</string>
|
||||||
<string name="load_back">load_back</string>
|
<string name="load_back">load_back</string>
|
||||||
<string name="launch_version">获取游戏版本</string>
|
<string name="launch_version">获取游戏版本</string>
|
||||||
|
@ -15,6 +15,9 @@ buildscript {
|
|||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
|
||||||
|
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
|
||||||
|
classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user