Ejemplo n.º 1
1
  @UnityCallable
  public static void GetAppLink(String paramsStr) {
    Log.v(TAG, "GetAppLink(" + paramsStr + ")");
    final UnityParams unityParams = UnityParams.parse(paramsStr);
    UnityMessage unityMessage =
        UnityMessage.createWithCallbackFromParams("OnGetAppLinkComplete", unityParams);

    // If we don't have an intent return
    if (intent == null) {
      unityMessage.put("did_complete", true);
      unityMessage.send();
      return;
    }

    // Check to see if we have any app link data on the intent
    AppLinkData appLinkData = AppLinkData.createFromAlApplinkData(intent);
    if (appLinkData != null) {
      // We have an app link
      FB.addAppLinkToMessage(unityMessage, appLinkData);
      unityMessage.put("url", intent.getDataString());
    } else if (intent.getData() != null) {
      // We have a deep link
      unityMessage.put("url", intent.getDataString());
    } else {
      // No deep link or app link was provided when activity was started
      unityMessage.put("did_complete", true);
    }

    unityMessage.send();
  }