update 支持安卓高版本 逍遥模拟器安装 去除多余的头条 热云配置
| | |
| | | android:resource="@xml/file_paths" /> |
| | | </provider> |
| | | |
| | | <meta-data |
| | | android:name="TrackAppID" |
| | | android:value="34984be594b93353e6fd41d0b4f3b78" /> |
| | | <meta-data |
| | | android:name="TrackChannelID" |
| | | android:value="_default_" /> |
| | | |
| | | <!-- 今日头条相关配置 --> |
| | | <meta-data |
| | | android:name="TouTiao_AppName" |
| | | android:value="mhtj_ne" /> |
| | | <meta-data |
| | | android:name="TouTiao_AppID" |
| | | android:value="16232" /> |
| | | <meta-data |
| | | android:name="TouTiao_Chanel" |
| | | android:value="_default_" /> |
| | | |
| | | <!-- MG SDK 配置 start --> |
| | | <activity |
| | | android:name="com.mgbase.ui.LoginActivity" |
| | |
| | | |
| | | defaultConfig { |
| | | //applicationId "com.secondworld.univeralsdk" |
| | | minSdkVersion 23 |
| | | targetSdkVersion 23 |
| | | minSdkVersion 19 |
| | | targetSdkVersion 22 |
| | | versionCode 1 |
| | | versionName "1.1.0" |
| | | } |
| | |
| | | // -------------------------------------------------------------- |
| | | manifestPlaceholders.put("JpushAppKey", "fde69694a5e00c2813740da3") // 2.0 |
| | | manifestPlaceholders.put("appId", "com.mhtj.mg") //2.0 |
| | | manifestPlaceholders.put("TrackAppID", "34984be594b93353e6fd41d0b4f3b78") // 2.0 |
| | | manifestPlaceholders.put("TT_AppName", "mhtj_ne") // 2.0 |
| | | manifestPlaceholders.put("TT_AppID", "16232") // 2.0 |
| | | // -------------------------------------------------------------- |
| | | manifestPlaceholders.put("TrackChannelID", "_default_") |
| | | manifestPlaceholders.put("TT_Chanel", "_default_") |
| | | // -------------------------------------------------------------- |
| | | // <meta-data android:name="qd_code" android:value="32016"></meta-data> |
| | | // <meta-data android:name="XOPENSDK_APPKEY" android:value="323"></meta-data> |
| | |
| | | android:resource="@xml/file_paths" /> |
| | | </provider> |
| | | |
| | | <meta-data |
| | | android:name="TrackAppID" |
| | | android:value="${TrackAppID}" /> |
| | | <meta-data |
| | | android:name="TrackChannelID" |
| | | android:value="${TrackChannelID}" /> |
| | | |
| | | <!-- 今日头条相关配置 --> |
| | | <meta-data |
| | | android:name="TouTiao_AppName" |
| | | android:value="${TT_AppName}" /> |
| | | <meta-data |
| | | android:name="TouTiao_AppID" |
| | | android:value="${TT_AppID}" /> |
| | | <meta-data |
| | | android:name="TouTiao_Chanel" |
| | | android:value="${TT_Chanel}" /> |
| | | |
| | | <!-- MG SDK 配置 start --> |
| | | <activity |
| | |
| | | import com.ss.android.common.applog.TeaConfigBuilder; |
| | | //import com.ss.android.common.lib.EventUtils; |
| | | import com.unity3d.player.UnityPlayer; |
| | | import com.xy.xypay.utils.XYPaySDK; |
| | | |
| | | import org.json.JSONException; |
| | | import org.json.JSONObject; |
| | |
| | | case CodeU2A.DownloadEnd: |
| | | KYPlatformUtil.getInstance().DownloadEnd(); |
| | | break; |
| | | case CodeU2A.HideFloatIcon: |
| | | XYPaySDK.hideFloatWindow(_activity); |
| | | break; |
| | | case CodeU2A.ShowFloatIcon: |
| | | XYPaySDK.showFloatWindow(_activity); |
| | | break; |
| | | } |
| | | |
| | | } catch (JSONException e) |
| | |
| | | public void run() |
| | | { |
| | | LogUtil.i(TAG, "开始执行初始化"); |
| | | |
| | | GetExternalStorage(); |
| | | |
| | | // ------------------------------- 设备信息 ------------------------------- |
| | |
| | | _msgStruct.put("code", CodeA2U.DeviceInfo); |
| | | _msgStruct.put("userAgent", System.getProperty("http.agent")); |
| | | _msgStruct.put("mac", UniqueID.getLocalMac(activity)); |
| | | _msgStruct.put("imei", UniqueID.getDeviceId(activity)); |
| | | // _msgStruct.put("imei", "asdjhaskdhaksjdhjaskhda"); |
| | | _msgStruct.put("imei", UniqueID.get(activity)); |
| | | _msgStruct.put("android_id", |
| | | Settings.System.getString(activity.getContentResolver(), |
| | | Settings.System.ANDROID_ID)); |
| | |
| | | _msgStruct.put("channelPlatform", "ky"); |
| | | _msgStruct.put("kyAppID", "323"); |
| | | UniversalUtil.sendMessageToUnity(_msgStruct); |
| | | |
| | | } |
| | | |
| | | }).start(); |
| | |
| | | // ------------------------------- 猫耳SDK ------------------------------- |
| | | KYPlatformUtil.getInstance().init(activity); |
| | | |
| | | TeaAgent.init(TeaConfigBuilder.create(activity) |
| | | .setAppName(UniversalUtil.getMetaString(activity, |
| | | "TouTiao_AppName")) |
| | | .setChannel(UniversalUtil.getMetaString(activity, |
| | | "TouTiao_Chanel")) |
| | | .setAid(UniversalUtil.getMetaInt(activity, "TouTiao_AppID")) |
| | | .createTeaConfig()); |
| | | |
| | | TeaAgent.setDebug(true); |
| | | } |
| | | |
| | | private static boolean m_IsFocus = true; |
| | |
| | | public static final int ClientPackage = 400; |
| | | public static final int SendRegistEvent = 500; |
| | | public static final int SendLoginEvent = 600; |
| | | /** |
| | | * 隐藏悬浮窗 |
| | | */ |
| | | public static final int HideFloatIcon = 700; |
| | | /** |
| | | * 显示悬浮窗 |
| | | */ |
| | | public static final int ShowFloatIcon = 701; |
| | | } |
| | |
| | | |
| | | public class FileUtil |
| | | { |
| | | |
| | | private static final String TAG = "H2Engine_FileUtil"; |
| | | |
| | | private static Boolean IsDoingCopyBuildin = false; |
| | | |
| | | public static void copyOneAssetsInOneFunc(final Activity activity) |
| | | { |
| | | if (IsDoingCopyBuildin) |
| | | return; |
| | | IsDoingCopyBuildin = true; |
| | | new Thread(new Runnable() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | String[] _fileNames = new String[]{ |
| | | "builtin_assetbundle", |
| | | "builtin_assetbundle.manifest", |
| | | "builtin/musics", |
| | | "builtin/musics.manifest", |
| | | "builtin/prefabs", |
| | | "builtin/prefabs.manifest", |
| | | "builtin/sprites", |
| | | "builtin/sprites.manifest", |
| | | "builtin/animationclips", |
| | | "builtin/animationclips.manifest", |
| | | "builtin/materials", |
| | | "builtin/materials.manifest", |
| | | "builtin/scriptableobjects", |
| | | "builtin/scriptableobjects.manifest", |
| | | "builtin/font", |
| | | "builtin/font.manifest", |
| | | "config/Contact.txt", |
| | | "config/HelpInfo.txt", |
| | | "config/PriorBundle.txt", |
| | | "config/PriorLanguage.txt", |
| | | "config/ApkUpdateUrl.txt", |
| | | }; |
| | | for (String _fileName : _fileNames) |
| | | { |
| | | copy(activity, _fileName); |
| | | } |
| | | } |
| | | }).start(); |
| | | } |
| | | |
| | | /** |
| | | * Unity随包资源(StreamingAssets)拷贝至 persistentDataPath 路径下 |
| | |
| | | "").getAbsolutePath() + File.separator + fileName; |
| | | String _destDir = _destPath.substring(0, _destPath.lastIndexOf('/') + 1); |
| | | File _file = new File(_destDir); |
| | | if(!_file.exists()) |
| | | if (!_file.exists()) |
| | | { |
| | | LogUtil.i(TAG,"单独拷贝 => 不存在指定路径: " + _destDir + ", 这里创建..."); |
| | | LogUtil.i(TAG, "单独拷贝 => 不存在指定路径: " + _destDir + ", 这里创建..."); |
| | | _file.mkdir(); |
| | | } |
| | | try |
| | |
| | | |
| | | super.onResume(); |
| | | |
| | | // 检测本地存储权限是否有, 没有的话要提示用户 |
| | | if (PermissionChecker.checkPermission(this, |
| | | Manifest.permission.WRITE_EXTERNAL_STORAGE, |
| | | Process.myPid(), Process.myUid(), |
| | | getPackageName()) != PackageManager.PERMISSION_GRANTED |
| | | || PermissionChecker.checkPermission(this, |
| | | Manifest.permission.READ_EXTERNAL_STORAGE, |
| | | Process.myPid(), Process.myUid(), |
| | | getPackageName()) != PackageManager.PERMISSION_GRANTED) |
| | | { |
| | | new AlertDialog.Builder(this) |
| | | .setMessage("应用没有存储读取权限,点击确定至设置中开启,否则无法继续游戏.") |
| | | .setCancelable(false) |
| | | .setPositiveButton("确定", |
| | | new DialogInterface.OnClickListener() |
| | | { |
| | | @Override |
| | | public void onClick(DialogInterface dialogInterface, |
| | | int i) |
| | | { |
| | | UniversalUtil.hasGoToSetting = true; |
| | | Intent intent = new Intent( |
| | | Settings.ACTION_APPLICATION_DETAILS_SETTINGS); |
| | | intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | Uri uri = Uri.fromParts("package", |
| | | getPackageName(), |
| | | null); |
| | | intent.setData(uri); |
| | | startActivity(intent); |
| | | } |
| | | }) |
| | | .setNegativeButton("拒绝", |
| | | new DialogInterface.OnClickListener() |
| | | { |
| | | @Override |
| | | public void onClick(DialogInterface dialogInterface, |
| | | int i) |
| | | { |
| | | finish(); |
| | | } |
| | | }) |
| | | .show(); |
| | | } |
| | | // // 检测本地存储权限是否有, 没有的话要提示用户 |
| | | // if (PermissionChecker.checkPermission(this, |
| | | // Manifest.permission.WRITE_EXTERNAL_STORAGE, |
| | | // Process.myPid(), Process.myUid(), |
| | | // getPackageName()) != PackageManager.PERMISSION_GRANTED |
| | | // || PermissionChecker.checkPermission(this, |
| | | // Manifest.permission.READ_EXTERNAL_STORAGE, |
| | | // Process.myPid(), Process.myUid(), |
| | | // getPackageName()) != PackageManager.PERMISSION_GRANTED) |
| | | // { |
| | | // new AlertDialog.Builder(this) |
| | | // .setMessage("应用没有存储读取权限,点击确定至设置中开启,否则无法继续游戏.") |
| | | // .setCancelable(false) |
| | | // .setPositiveButton("确定", |
| | | // new DialogInterface.OnClickListener() |
| | | // { |
| | | // @Override |
| | | // public void onClick(DialogInterface dialogInterface, |
| | | // int i) |
| | | // { |
| | | // UniversalUtil.hasGoToSetting = true; |
| | | // Intent intent = new Intent( |
| | | // Settings.ACTION_APPLICATION_DETAILS_SETTINGS); |
| | | // intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | // Uri uri = Uri.fromParts("package", |
| | | // getPackageName(), |
| | | // null); |
| | | // intent.setData(uri); |
| | | // startActivity(intent); |
| | | // } |
| | | // }) |
| | | // .setNegativeButton("拒绝", |
| | | // new DialogInterface.OnClickListener() |
| | | // { |
| | | // @Override |
| | | // public void onClick(DialogInterface dialogInterface, |
| | | // int i) |
| | | // { |
| | | // finish(); |
| | | // } |
| | | // }) |
| | | // .show(); |
| | | // } |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | StringBuffer _buffer = new StringBuffer(); |
| | | |
| | | _id = getDeviceId(context); |
| | | _buffer.append(_id); |
| | | // _id = getDeviceId(context); |
| | | // _buffer.append(_id); |
| | | |
| | | _id = getLocalMac(context).replace(":", ""); |
| | | _buffer.append(_id); |
| | |
| | | return _deviceId; |
| | | } |
| | | |
| | | TelephonyManager tm = (TelephonyManager) context |
| | | .getSystemService(Context.TELEPHONY_SERVICE); |
| | | |
| | | if (ContextCompat.checkSelfPermission(context, |
| | | Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) |
| | | { |
| | | TelephonyManager tm = (TelephonyManager) context |
| | | .getSystemService(Context.TELEPHONY_SERVICE); |
| | | _deviceId = tm.getDeviceId(); |
| | | } |
| | | else |
| | | { |
| | | _deviceId = get(context); |
| | | } |
| | | |
| | | if (_deviceId.length() != 0) |