Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetchDeferredAppLink method returns null in android and undefined in iOS #234

Closed
sarafcredable opened this issue Apr 25, 2022 · 2 comments
Closed
Labels
wontfix This will not be worked on

Comments

@sarafcredable
Copy link

sarafcredable commented Apr 25, 2022

🐛 Bug Report

AppLink.fetchDeferredAppLink() always returns null in android and undefined in iOS.

To Reproduce

I use https://developers.facebook.com/tools/app-ads-helper to test the deep-link. Here i enter the uri-scheme of the app and checked both Send Notification & Send Deferred.

It shows two popup,

Screenshot 2022-04-26 at 4 45 14 AM

Screenshot 2022-04-26 at 4 45 34 AM

If i click on the notification which i received on the developer facebook account, it is opening the installed app, but the method AppLink.fetchDeferredAppLink() always returns null/undefined.

I tried uninstaling the app, then clicked on the deferred link, then installed and opened the app, still same.

Code Example

const fbsdkInit = (bool) => {
  if (bool) {
    Settings.setAdvertiserTrackingEnabled(bool).then(() => {
      Settings.initializeSDK();
      AppLink.fetchDeferredAppLink().then((link) =>
        console.log("Link 1", link)
      );
    });
  } else {
    Settings.initializeSDK();
    AppLink.fetchDeferredAppLink().then((link) => console.log("Link 2", link));
  }
};

async function getATTPermissionForFbAppEvents() {
  const ATT_CHECK = await check(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
  if (ATT_CHECK === RESULTS.DENIED) {
    try {
      const ATT = await request(PERMISSIONS.IOS.APP_TRACKING_TRANSPARENCY);
      if (ATT === RESULTS.DENIED) {
        getATTPermissionForFbAppEvents();
      } else {
        if (ATT === RESULTS.GRANTED) {
          fbsdkInit(true);
        } else {
          fbsdkInit(false);
        }
      }
    } catch (error) {
      fbsdkInit(false);
    }
  } else if (ATT_CHECK === RESULTS.GRANTED) {
    fbsdkInit(true);
  } else {
    fbsdkInit(false);
  }
}

componentDidMount() {
  if (Platform.OS === "ios" && Number(Platform.Version) > 14.4) {
    getATTPermissionForFbAppEvents();
  } else {
    fbsdkInit(true);
  }
}
@mikehardy
Copy link
Collaborator

Hi there! You have not included enough information about your software environment (versions etc) or test environment (device used, device details) to troubleshoot https://stackoverflow.com/help/how-to-ask

But more importantly I need to set clear expectations here: this is not a use case of mine so I have no time to spend on it to help you, I do sincerely apologize, but https://hackernoon.com/i-thought-i-understood-open-source-i-was-wrong-cf54999c097b - it's not my job ;-)

My general process for inspection on issues like this is:

  • crack open node_modules/react-native-fbsdk-next in an editor
  • get used to the typescript build process so you can make edits and build them and retry
  • implement a console.log('hello world') sort of thing in one of your api calls to make sure you are actually making changes
  • instrument all related API calls in the typescript that you call with logging of all parameters sent to native module and all return values that come back
  • instrument all related native module calls with logging of all parameters received from javascript and all return values to send to javascript, and the same for all the system APIs called and their return values

Plug in a device and do iOS builds from Xcode so you get the console logging clean. For android it's adb logcat and you can do adb logcat | grep 'MY OBVIOUS STRING FOR FILTERING HERE' to get your log messages

That's usually it. I read the documentation on the related API calls that the module uses, compare my parameters sent and return values received with expectations and see where it goes

I will be happy to merge a PR that looks reasonable and has references to the "why" of any changes you made, but won't have time to help further

@stale
Copy link

stale bot commented May 26, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label May 26, 2022
@stale stale bot closed this as completed Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants