| | |
| | | |
| | | import com.allugame.freesdk.port.FreePlatform; |
| | | import com.reyun.tracking.sdk.Tracking; |
| | | import com.ss.android.common.applog.TeaAgent; |
| | | import com.ss.android.common.applog.TeaConfigBuilder; |
| | | import com.ss.android.common.lib.EventUtils; |
| | | import com.unity3d.player.UnityPlayer; |
| | | |
| | | import org.json.JSONException; |
| | |
| | | _json.getString("payType"), |
| | | _json.getString("moneyType"), |
| | | (float) _json.getDouble("money")); |
| | | |
| | | int _money = (int)(_json.getDouble("money")); |
| | | |
| | | LogUtil.i(TAG,"金额: " + _money); |
| | | |
| | | EventUtils.setPurchase(null, |
| | | null, |
| | | null, |
| | | 1, |
| | | _json.getString("payType"), |
| | | _json.getString("moneyType"), |
| | | true, |
| | | _money); |
| | | break; |
| | | case CodeU2A.ClientPackage: |
| | | // ------------------------------- 热云相关 ------------------------------- |
| | | PackageManager _pkgMgr = _activity.getPackageManager(); |
| | | ApplicationInfo _appInfo; |
| | | try |
| | | { |
| | | _appInfo = _pkgMgr.getApplicationInfo(_activity.getPackageName(), |
| | | PackageManager.GET_META_DATA); |
| | | |
| | | // 获取热云的appID以及渠道名称 |
| | | String _trackAppID = _appInfo.metaData.getString("TrackAppID"); |
| | | String _trackChanelID = _json.getString("clientPkgID"); |
| | | LogUtil.i(TAG, "热云AppID为: " + _trackAppID + ", 热云渠道ID: " + _trackChanelID); |
| | | // 初始化热云 |
| | | Tracking.initWithKeyAndChannelId(_activity, _trackAppID, _trackChanelID); |
| | | } catch (PackageManager.NameNotFoundException e) |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | // 初始化热云 |
| | | Tracking.initWithKeyAndChannelId(_activity, |
| | | UniversalUtil.getMetaString(_activity,"TrackAppID"), |
| | | _json.getString("clientPkgID")); |
| | | break; |
| | | case CodeU2A.JPushAddLocalMessage: |
| | | addLocalNotification(_activity, |
| | |
| | | { |
| | | Intent _intent = new Intent(Intent.ACTION_VIEW); |
| | | |
| | | if (Build.VERSION.SDK_INT >= 23) |
| | | { |
| | | _intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| | | Uri _contentUri = FileProvider.getUriForFile(activity, |
| | | "com.shandangceshi.snxxz.fileProvider", |
| | | _file); |
| | | _intent.setDataAndType(_contentUri, "application/vnd.android.package-archive"); |
| | | |
| | | } |
| | | else |
| | | { |
| | | // if (Build.VERSION.SDK_INT >= 23) |
| | | // { |
| | | // _intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); |
| | | // Uri _contentUri = FileProvider.getUriForFile(activity, |
| | | // "com.shandangceshi.snxxz.fileProvider", |
| | | // _file); |
| | | // _intent.setDataAndType(_contentUri, "application/vnd.android.package-archive"); |
| | | // |
| | | // } |
| | | // else |
| | | // { |
| | | _intent.setDataAndType(Uri.fromFile(_file), |
| | | "application/vnd.android.package-archive"); |
| | | _intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| | | |
| | | } |
| | | // } |
| | | |
| | | activity.startActivity(_intent); |
| | | |
| | |
| | | |
| | | // ------------------------------- 自由SDK ------------------------------- |
| | | FreePlatformUtil.getInstace().init(activity); |
| | | LogUtil.i(TAG,"步骤: 1"); |
| | | // ------------------------------- 极光推送 ------------------------------- |
| | | JPushInterface.setDebugMode(true); |
| | | LogUtil.i(TAG,"步骤: 2"); |
| | | JPushInterface.init(activity); |
| | | LogUtil.i(TAG,"步骤: 3"); |
| | | // ------------------------------- 今天头条 ----------------------- |
| | | 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); |
| | | |
| | | final long _waitingTime = System.currentTimeMillis(); |
| | | |
| | | while (true) |
| | | { |
| | | // 等待获取极光registrationID |
| | | if (!JPushInterface.getRegistrationID(activity).equals("")) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | long _escapeTime = System.currentTimeMillis() - _waitingTime; |
| | | |
| | | if (_escapeTime > 3000) |
| | | { |
| | | LogUtil.w(TAG,"等待获取极光推送registrationID超时: 3秒"); |
| | | break; |
| | | } |
| | | } |
| | |
| | | FreePlatform.getInstance().onCreate(); |
| | | } |
| | | |
| | | public static void onNewIntent(Intent intent) { } |
| | | public static void onNewIntent(final Intent intent) { } |
| | | |
| | | public static void onConfigurationChanged(Configuration newConfig) {} |
| | | public static void onConfigurationChanged(final Configuration newConfig) {} |
| | | |
| | | public static void onRestart() { } |
| | | public static void onRestart(final Activity activity) { } |
| | | |
| | | public static void onStart() |
| | | public static void onStart(final Activity activity) |
| | | { |
| | | FreePlatform.getInstance().onStart(); |
| | | } |
| | | |
| | | public static void onPause() |
| | | public static void onPause(final Activity activity) |
| | | { |
| | | FreePlatform.getInstance().onPause(); |
| | | TeaAgent.onPause(activity); |
| | | } |
| | | |
| | | public static void onResume() |
| | | public static void onResume(final Activity activity) |
| | | { |
| | | FreePlatform.getInstance().onResume(); |
| | | TeaAgent.onResume(activity); |
| | | } |
| | | |
| | | public static void onStop() |
| | | public static void onStop(final Activity activity) |
| | | { |
| | | FreePlatform.getInstance().onStop(); |
| | | } |
| | | |
| | | public static void onDestroy() |
| | | public static void onDestroy(final Activity activity) |
| | | { |
| | | FreePlatform.getInstance().onDestory(); |
| | | Tracking.exitSdk(); |