예제 #1
0
  @UnityCallable
  public static void RefreshCurrentAccessToken(String paramsStr) {
    FB.LogMethodCall("RefreshCurrentAccessToken", paramsStr);

    UnityParams unityParams = UnityParams.parse(paramsStr);
    final UnityMessage unityMessage = new UnityMessage("OnRefreshCurrentAccessTokenComplete");
    if (unityParams.hasString("callback_id")) {
      unityMessage.put("callback_id", unityParams.getString("callback_id"));
    }

    AccessToken.refreshCurrentAccessTokenAsync(
        new AccessToken.AccessTokenRefreshCallback() {
          @Override
          public void OnTokenRefreshed(AccessToken accessToken) {
            FBLogin.addLoginParametersToMessage(unityMessage, accessToken, null);
            unityMessage.send();
          }

          @Override
          public void OnTokenRefreshFailed(FacebookException e) {
            unityMessage.sendError(e.getMessage());
          }
        });

    AppLinkData.fetchDeferredAppLinkData(
        getUnityActivity(),
        new AppLinkData.CompletionHandler() {
          @Override
          public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
            FB.addAppLinkToMessage(unityMessage, appLinkData);
            unityMessage.send();
          }
        });
  }
예제 #2
0
  @UnityCallable
  public static void FetchDeferredAppLinkData(String paramsStr) {
    FB.LogMethodCall("FetchDeferredAppLinkData", paramsStr);

    UnityParams unityParams = UnityParams.parse(paramsStr);
    final UnityMessage unityMessage = new UnityMessage("OnFetchDeferredAppLinkComplete");
    if (unityParams.hasString("callback_id")) {
      unityMessage.put("callback_id", unityParams.getString("callback_id"));
    }

    AppLinkData.fetchDeferredAppLinkData(
        getUnityActivity(),
        new AppLinkData.CompletionHandler() {
          @Override
          public void onDeferredAppLinkDataFetched(AppLinkData appLinkData) {
            FB.addAppLinkToMessage(unityMessage, appLinkData);
            unityMessage.send();
          }
        });
  }