cordova-plugin-facebook-connect / cordova-plugin-facebook-connect

Use the latest Facebook SDK in your Cordova and Ionic projects
Other
63 stars 90 forks source link

Disable event collection dynamically? #111

Open andrerds opened 2 years ago

andrerds commented 2 years ago

Hey guys!. Has anyone of you ever needed to deactivate and activate the plugin in the Events part, dynamically?

I know there is facebookconnect.activateApp()

is there a way to disable it?

 public activeFacebook() {
    return this.fb.activateApp();
  }

Plugin version: cordova-plugin-facebook-connect@3.2.0 Ionic info:

Ionic:

   Ionic CLI                     : 5.4.16
   Ionic Framework               : @ionic/angular 5.9.3
   @angular-devkit/build-angular : 12.0.5
   @angular-devkit/schematics    : 12.0.5
   @angular/cli                  : 12.0.5
   @ionic/angular-toolkit        : 4.0.0

Capacitor:

   Capacitor CLI   : 3.2.4
   @capacitor/core : 3.2.4

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (1 plugins total)

Utility:

   cordova-res (update available: 0.15.4) : 0.15.3
   native-run                             : 1.5.0

System:

   Android SDK Tools : 26.1.1 (/Volumes/home/Library/Android/sdk)
   NodeJS            : v12.18.3 (/Volumes/home/.nvm/versions/node/v12.18.3/bin/node)
   npm               : 6.14.6
   OS                : macOS Big Sur
   Xcode             : Xcode 13.2.1 Build version 13C100
andrerds commented 2 years ago

Hey guys!. Has anyone of you ever needed to deactivate and activate the plugin in the Events part, dynamically?

I know there is facebookconnect.activateApp()

is there a way to disable it?

 public activeFacebook() {
    return this.fb.activateApp();
  }

Plugin version: cordova-plugin-facebook-connect@3.2.0 Ionic info:

Ionic:

   Ionic CLI                     : 5.4.16
   Ionic Framework               : @ionic/angular 5.9.3
   @angular-devkit/build-angular : 12.0.5
   @angular-devkit/schematics    : 12.0.5
   @angular/cli                  : 12.0.5
   @ionic/angular-toolkit        : 4.0.0

Capacitor:

   Capacitor CLI   : 3.2.4
   @capacitor/core : 3.2.4

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (1 plugins total)

Utility:

   cordova-res (update available: 0.15.4) : 0.15.3
   native-run                             : 1.5.0

System:

   Android SDK Tools : 26.1.1 (/Volumes/home/Library/Android/sdk)
   NodeJS            : v12.18.3 (/Volumes/home/.nvm/versions/node/v12.18.3/bin/node)
   npm               : 6.14.6
   OS                : macOS Big Sur
   Xcode             : Xcode 13.2.1 Build version 13C100

Hey guys, I managed to enable and disable the events, see the code below. ` private setAdvertiserIDCollectionEnabled(active: boolean) { return this.fb .setAdvertiserIDCollectionEnabled(active) .then(() => { console.log('setAdvertiserIDCollectionEnabled success'); }) .catch(() => { console.error('setAdvertiserIDCollectionEnabled failure'); }); } private setAdvertiserTrackingEnabled(active: boolean) { // Aplicavel somente em ios; return this.fb .setAdvertiserTrackingEnabled(active) .then(() => { console.log('setAdvertiserTrackingEnabled success'); }) .catch(() => { console.error('setAdvertiserTrackingEnabled failure'); }); }

private setAutoLogAppEventsEnabled(active: boolean) { return this.fb .setAutoLogAppEventsEnabled(active) .then(() => { console.log('setAutoLogAppEventsEnabled success'); }) .catch(() => { console.error('setAutoLogAppEventsEnabled failure'); }); } `

But another problem arises. On the iphone (real device) the events are not appearing, the number of events always increases, but facebook does not show it because we have the app also for android, thus making it difficult to see if the events are really not (recording). Has anyone had this problem with iphone?. ah! very important point, the tests done on the iOS 15.2 emulator (iphone emulator) appeared the screen shots.