Skip to content
This repository has been archived by the owner on Apr 2, 2021. It is now read-only.

Disable and enable automatic event logging arcording to GDPR #465

Open
Hanspagh opened this issue Jan 24, 2019 · 13 comments
Open

Disable and enable automatic event logging arcording to GDPR #465

Hanspagh opened this issue Jan 24, 2019 · 13 comments

Comments

@Hanspagh
Copy link

Hanspagh commented Jan 24, 2019

Hi.
I can see it is possible in the android and iOS sdk to disable and only after the user has consented then enable automatic event logging again, see the provided Link for more details.
Is this something that is also possible in the RN sdk?

@peteychuk
Copy link

Any updates on this?

@Hanspagh
Copy link
Author

I ended up fixing it by editing the info.Plist and the android manifest of the facebook SDK as described here https://developers.facebook.com/docs/app-events/getting-started-app-events-android#disable-auto-events and then made a custom hook to enable them

@peteychuk
Copy link

peteychuk commented Mar 22, 2019

Thank you @Hanspagh,
For IOS documentation described here:
https://developers.facebook.com/docs/app-events/getting-started-app-events-ios (Disable Automatically Logged Events)

UPD:
A related issue: #461

@obendevski
Copy link

Any updates regarding this?

@obendevski
Copy link

I ended up fixing it by editing the info.Plist and the android manifest of the facebook SDK as described here https://developers.facebook.com/docs/app-events/getting-started-app-events-android#disable-auto-events and then made a custom hook to enable them

Can you please tell me how you did it with the custom hook?

@Hanspagh
Copy link
Author

@obendevski Its been a while, but it was something a long the lines of this
https://dev.to/evenmik/react-native-bridge-for-android-and-ios-405k
and then the native call was just to setAutoLogAppEventsEnabled(true)

@obendevski
Copy link

@obendevski Its been a while, but it was something a long the lines of this
https://dev.to/evenmik/react-native-bridge-for-android-and-ios-405k
and then the native call was just to setAutoLogAppEventsEnabled(true)

Great, thank you very much. Just one more thing, where do you import the setAutoLogAppEventsEnabled from ? I will need to install the separate sdks for android and iOS, right? Because I cant find any reference to the method in the react-native-fb-sdk.

@Hanspagh
Copy link
Author

Yes, but I am also pretty sure, this is a requiment for the libary anyways

@stephanpavlovic
Copy link

@obendevski Its been a while, but it was something a long the lines of this
https://dev.to/evenmik/react-native-bridge-for-android-and-ios-405k
and then the native call was just to setAutoLogAppEventsEnabled(true)

Great, thank you very much. Just one more thing, where do you import the setAutoLogAppEventsEnabled from ? I will need to install the separate sdks for android and iOS, right? Because I cant find any reference to the method in the react-native-fb-sdk.

Did you pull it of @obendevski? I'm trying to do the exact same thing ...

@obendevski
Copy link

@stephanpavlovic I did it, yes. I will write it here ASAP, next few days.

@plaa
Copy link

plaa commented Oct 27, 2020

@obendevski I am struggling with importing classes from the react-native-fbsdk libraries. How did you handle them?

I managed to get iOS working by adding #import <FBSDKCoreKit.h> to my Swift bridging header and then using Settings.isAutoLogAppEventsEnabled = enabled.

On Android I am unable to import com.facebook.FacebookSdk. It seems that the library is included through react-native-fbsdk, but is not on the classpath during build time. I even tried manually linking the package (only gradle files) but compiling still fails.

@obendevski
Copy link

Hey, @plaa , I had the same problem, had to add the android fbsdk.
In app/build.gradle add:
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'.
In android/build.gradle, add:
mavenCentral() in repositories.

Then, you can import com.facebook.FacebookSdk; in your custom module.
Hope it helps,
Let me know if it works!

@plaa
Copy link

plaa commented Oct 27, 2020

Thanks @obendevski!

For me it was sufficient to add the implementation statement in app/build.gradle, the mavenCentral() was unnecessary. I guess the npm packages add that automatically, as it's not in my config. I had to exit + clean to get Android Studio to detect the library.

For those wondering, the implementation statement requires any 5.x version of facebook-android-sdk to be included in the build. The react-native-fbsdk npm package will decide the exact version that will be included.

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

No branches or pull requests

5 participants