private static void startActivity(Class<?> cls, String paramsStr) { Intent intent = new Intent(getUnityActivity(), cls); UnityParams unityParams = UnityParams.parse(paramsStr); Bundle params = unityParams.getStringParams(); intent.putExtra(BaseActivity.ACTIVITY_PARAMS, params); getUnityActivity().startActivity(intent); }
@UnityCallable public static void LogAppEvent(String params_str) { Log.v(TAG, "LogAppEvent(" + params_str + ")"); UnityParams unity_params = UnityParams.parse(params_str); Bundle parameters = new Bundle(); if (unity_params.has("parameters")) { UnityParams unity_params_parameter = unity_params.getParamsObject("parameters"); parameters = unity_params_parameter.getStringParams(); } if (unity_params.has("logPurchase")) { FB.getAppEventsLogger() .logPurchase( new BigDecimal(unity_params.getDouble("logPurchase")), Currency.getInstance(unity_params.getString("currency")), parameters); } else if (unity_params.hasString("logEvent")) { if (unity_params.has("valueToSum")) { FB.getAppEventsLogger() .logEvent( unity_params.getString("logEvent"), unity_params.getDouble("valueToSum"), parameters); } else { FB.getAppEventsLogger().logEvent(unity_params.getString("logEvent"), parameters); } } else { Log.e(TAG, "couldn't logPurchase or logEvent params: " + params_str); } }
@UnityCallable public static void AppInvite(String paramsStr) { Log.v(TAG, "AppInvite(" + paramsStr + ")"); Intent intent = new Intent(getUnityActivity(), AppInviteDialogActivity.class); UnityParams unityParams = UnityParams.parse(paramsStr); Bundle params = unityParams.getStringParams(); intent.putExtra(AppInviteDialogActivity.DIALOG_PARAMS, params); getUnityActivity().startActivity(intent); }
@UnityCallable public static void GameGroupJoin(String params_str) { Log.v(TAG, "GameGroupJoin(" + params_str + ")"); final UnityParams unity_params = UnityParams.parse(params_str); final Bundle params = unity_params.getStringParams(); Intent intent = new Intent(getUnityActivity(), FBUnityJoinGameGroupActivity.class); intent.putExtra(FBUnityJoinGameGroupActivity.JOIN_GAME_GROUP_PARAMS, params); getUnityActivity().startActivity(intent); }
@UnityCallable public static void AppRequest(String params_str) { Log.v(TAG, "AppRequest(" + params_str + ")"); Intent intent = new Intent(getUnityActivity(), FBUnityGameRequestActivity.class); UnityParams unity_params = UnityParams.parse(params_str); Bundle params = unity_params.getStringParams(); intent.putExtra(FBUnityGameRequestActivity.GAME_REQUEST_PARAMS, params); getUnityActivity().startActivity(intent); }
@UnityCallable public static void FeedShare(String params_str) { Log.v(TAG, "FeedShare(" + params_str + ")"); final UnityParams unityParams = UnityParams.parse(params_str); final Bundle params = unityParams.getStringParams(); Intent intent = new Intent(getUnityActivity(), FBUnityDialogsActivity.class); intent.putExtra(FBUnityDialogsActivity.DIALOG_TYPE, ShareDialog.Mode.FEED); intent.putExtra(FBUnityDialogsActivity.FEED_DIALOG_PARAMS, params); getUnityActivity().startActivity(intent); }