1

We are attemptin to integrate the facebook SDK for analytics into an Ionic/Capacitor app. Obviously, when following the install instructions here`, it is not possible to run the command

ionic cordova plugin add cordova-plugin-facebook-connect --variable APP_ID="123456789" --variable APP_NAME="myApplication"

We have tried installing using NPM, however when running it seems unable to locate the App ID and the App Name on Android, returning these errors:

AAPT: error: resource string/fb_app_id (aka capacitor.android.plugins:string/fb_app_id) not found.

I have tried using the Facebook Capacitor Analyzer plugin found here but that just caused more issues.

Surely someone out there has achieved this integration? Am I missing something? I have declared the App_ID and name in a strings.xml file - but it looks within a seperate AndroidManifest.xml file located inside the capacitor-cordova-android-plugins folder, which is generated when built.

Please help, any advice would be amazing

David McIntyre
  • 218
  • 1
  • 9

1 Answers1

0

Is your app Capacitor or Cordova? Because in capacitor apps, Cordova hooks don't work & you have to manually edit the Native Project Files or set the capacitor config file instead.

i.e. setting these variables in the console does not work.

--variable APP_ID="123456789" 
--variable APP_NAME="myApplication"

please also check out the related SO post.

You can, however, use the capacitor configuration file & set the preferences here. example capacitor config:

{
  appId: "com.myapp.app",
  appName: "myApplication",
  cordova: {
    preferences: {
      APP_ID: "123456789",
      APP_NAME: "myApplication"
    }
}

selcuk-sahin
  • 327
  • 2
  • 10