Skip to content

Instantly share code, notes, and snippets.

@erenkulaksiz
Created April 22, 2024 07:13
Show Gist options
  • Save erenkulaksiz/526d0194494136b80fd2ba06368c0dc4 to your computer and use it in GitHub Desktop.
Save erenkulaksiz/526d0194494136b80fd2ba06368c0dc4 to your computer and use it in GitHub Desktop.
took some time to figure this custom config out.
const defineConfig = (config) => {
const { withAndroidManifest } = require('@expo/config-plugins');
config = withAndroidManifest(config, (config) => {
let androidManifest = config.modResults.manifest;
androidManifest.application = androidManifest.application || [];
androidManifest.application[0]["meta-data"].push({
$: {
"android:name":
"com.dieam.reactnativepushnotification.notification_color",
"android:resource": "@color/white",
},
});
androidManifest.application[0]["meta-data"].push({
$: {
"android:name": "com.google.android.gms.ads.APPLICATION_ID",
"android:value": "ca-app-pub-x",
},
});
if (!androidManifest.application[0].receiver) {
androidManifest.application[0].receiver = [];
}
androidManifest.application[0].receiver.push({
$: {
"android:name":
"com.dieam.reactnativepushnotification.modules.RNPushNotificationActions",
},
});
if (!androidManifest.application[0].receiver) {
androidManifest.application[0].receiver = [];
}
androidManifest.application[0].receiver.push({
$: {
"android:name":
"com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher",
},
});
if (!androidManifest.application[0].receiver) {
androidManifest.application[0].receiver = [];
}
androidManifest.application[0].receiver.push({
$: {
"android:name":
"com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver",
},
"intent-filter": [
{
action: [
{
$: {
"android:name": "android.intent.action.BOOT_COMPLETED",
},
},
{
$: {
"android:name": "android.intent.action.QUICKBOOT_POWERON",
},
},
{
$: {
"android:name": "com.htc.intent.action.QUICKBOOT_POWERON",
},
},
],
},
],
});
if (!androidManifest.application[0].service) {
androidManifest.application[0].service = [];
}
androidManifest.application[0].service.push({
$: {
"android:name":
"com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService",
"android:exported": "false",
},
"intent-filter": [
{
action: [
{
$: {
"android:name": "com.google.firebase.MESSAGING_EVENT",
},
},
],
},
],
});
return config;
})
return config
}
module.exports = defineConfig;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment