Пример #1
0
  @UnityCallable
  public static void Init(final String params_str) {
    Log.v(TAG, "Init(" + params_str + ")");
    UnityParams unity_params =
        UnityParams.parse(params_str, "couldn't parse init params: " + params_str);
    final String appID;
    if (unity_params.hasString("appId")) {
      appID = unity_params.getString("appId");
    } else {
      appID = Utility.getMetadataApplicationId(getUnityActivity());
    }

    FacebookSdk.setApplicationId(appID);
    FacebookSdk.sdkInitialize(
        FB.getUnityActivity(),
        new FacebookSdk.InitializeCallback() {
          @Override
          public void onInitialized() {
            final UnityMessage unityMessage = new UnityMessage("OnInitComplete");
            // If we have a cached access token send it back as well
            AccessToken token = AccessToken.getCurrentAccessToken();
            if (token != null) {
              FBLogin.addLoginParametersToMessage(unityMessage, token, null);
            } else {
              unityMessage.put("key_hash", FB.getKeyHash());
            }

            FB.ActivateApp(appID);

            unityMessage.send();
          }
        });
  }
Пример #2
0
 @UnityCallable
 public static String GetSdkVersion() {
   return FacebookSdk.getSdkVersion();
 }
Пример #3
0
 public static void SetLimitEventUsage(String params_str) {
   Log.v(TAG, "SetLimitEventUsage(" + params_str + ")");
   FacebookSdk.setLimitEventAndDataUsage(
       getUnityActivity().getApplicationContext(), Boolean.valueOf(params_str));
 }