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

Not working on Android for com.facebook.katana #56

Open
wwwguy opened this issue Dec 29, 2018 · 1 comment
Open

Not working on Android for com.facebook.katana #56

wwwguy opened this issue Dec 29, 2018 · 1 comment

Comments

@wwwguy
Copy link

wwwguy commented Dec 29, 2018

For some reason it isn't working on Android for detecting the installed Facebook app on the device. The test fails every time, even though the FB app is installed?

constructor(private appAvailability: AppAvailability) {

this.appAvailability.check('com.facebook.katana').then(
() => { // success callback
console.log('TEST success: com.facebook.katana');
},
() => { // error callback
console.log('TEST error: com.facebook.katana');
}
);

}

@joeysino
Copy link

The function does not return a promise, so you should not use .then()

constructor(private appAvailability: AppAvailability) {
  this.appAvailability.check(
    'com.facebook.katana',
    () => { // success callback
      console.log('TEST success: com.facebook.katana');
    },
    () => { // error callback
      console.log('TEST error: com.facebook.katana');
    }
  );
}

However, if you want to use Promises, we can turn the callbacks into promises with a wrapper function like this:

async function checkAppPromisified(appId: string) {
  return new Promise(resolve => {
    window.appAvailability.check(appId, () => resolve(true), (error) => resolve(false));
  });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants