diff --git a/packages/sdk-android/src/kotlinParser.ts b/packages/sdk-android/src/kotlinParser.ts index bd127785f..6e03e35a6 100644 --- a/packages/sdk-android/src/kotlinParser.ts +++ b/packages/sdk-android/src/kotlinParser.ts @@ -106,12 +106,13 @@ export const parseMainActivitySync = () => { const templatePath = 'app/src/main/java/rnv_template/MainActivity.kt'; - const templateAndroid = getConfigProp('templateAndroid', {}); + if (!c.payload.pluginConfigAndroid.injectActivityOnCreate) { + const templateAndroid = getConfigProp('templateAndroid'); - const mainActivity = templateAndroid?.MainActivity_kt; - - c.payload.pluginConfigAndroid.injectActivityOnCreate = - mainActivity?.onCreate || 'super.onCreate(savedInstanceState)'; + const mainActivity = templateAndroid?.MainActivity_kt; + c.payload.pluginConfigAndroid.injectActivityOnCreate = + mainActivity?.onCreate || 'super.onCreate(savedInstanceState)'; + } const injects = [ { pattern: '{{APPLICATION_ID}}', override: getAppId() }, @@ -206,7 +207,9 @@ export const injectPluginKotlinSync = (plugin: ConfigPluginPlatformSchema, key: c.payload.pluginConfigAndroid.pluginActivityResultMethods += `${mainActivity.resultMethods.join('\n ')}`; } } - + if (mainActivity?.onCreate) { + c.payload.pluginConfigAndroid.injectActivityOnCreate = mainActivity.onCreate; + } _injectPackage(c, plugin, pkg); const mainApplication = templ?.MainApplication_kt; diff --git a/packages/template-starter/renative.json b/packages/template-starter/renative.json index fe218be01..fdbdc6127 100644 --- a/packages/template-starter/renative.json +++ b/packages/template-starter/renative.json @@ -69,7 +69,7 @@ "org.gradle.configureondemand": true }, "MainActivity_kt": { - "onCreate": "super.onCreate(null)" + "onCreate": "super.onCreate(savedInstanceState)" } } }, @@ -84,9 +84,7 @@ "minSdkVersion": 21, "extendPlatform": "android", "engine": "engine-rn-tvos", - "includedPermissions": [ - "INTERNET" - ] + "includedPermissions": ["INTERNET"] }, "web": { "engine": "engine-rn-next"