appodeal / react-native-appodeal

Official React Native package that adds Appodeal SDK support to your react-native application.
https://appodeal.com
59 stars 37 forks source link

expo integration #85

Closed arsalan-arshad closed 2 years ago

arsalan-arshad commented 2 years ago

how to integrate into expo react native

Albermonte commented 2 years ago

Read #55

RoccoDocco commented 1 year ago

Shouldn't it be possible now with Expo Dev Builds?

LombaxTech commented 1 year ago

im curious about this too

gabrielcantarin commented 7 months ago

Hey guys does anyone succeed? I'd like to see the plugins you guys used for EXPO

salman-ibrahim commented 5 months ago

Hey guys does anyone succeed? I'd like to see the plugins you guys used for EXPO

I have created a gist just for this, you can find it here

Feel free to implement this any way you like, but here is how I did it:

...
"plugins": [
        ...
        ["./plugins/withAppodealBuildGradle.js"],
        ["./plugins/withAppodealGradle.js"],
        ["./plugins/withTrustLocalCerts.js"],
        [
            "./plugins/withAppodealManifest.js",
            {
                "metaData": {
                    "com.google.android.gms.ads.APPLICATION_ID": "your_admob_app_id",
                    "com.facebook.sdk.ApplicationId": "facebook_app_id",
                    "com.facebook.sdk.ClientToken": "meta_client_token"
                }
            }
        ]
    ],
...

I have kept each plugin for modifying one file only hance, 4 different files. Feel free to combine them into one if you want.

In my case I was doing it for the sake of flexibility so I added params to plugin directly from app.json, if you dont want to supply metaData from app.json feel free to modify withAppodealManifest.js to hard code them directly there.

My Expo Environment

Expo SDK: 48 Flow: Managed Appodeal NPM Package: "react-native-appodeal": "^3.2.1", Node Version: 18.18.0

Note

Your project will stop working in Expo Go after applying these plugins, make sure to run your project in development build afterwards.

Do not omit these values from manifest:

"com.google.android.gms.ads.APPLICATION_ID": "your_admob_app_id",
"com.facebook.sdk.ApplicationId": "facebook_app_id",
"com.facebook.sdk.ClientToken": "meta_client_token"

doing so will cause the app to crash at splash screen. If you want to exclude adMob or Meta SDK then follow the docs here

These configs are written to work with Android only. I would love to see if you can modify them to work with iOS as well.