Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intent filter block missing at AndroidManifest.xml file #334

Open
veronicatc opened this issue May 13, 2021 · 4 comments
Open

Intent filter block missing at AndroidManifest.xml file #334

veronicatc opened this issue May 13, 2021 · 4 comments

Comments

@veronicatc
Copy link

When adding the plugin to my project and then running the app for the first time with cordova run android, it works as expected.

But if I then make any change to my project, and run cordova run android again, then this intent filter block is missing from the AndroidManifest.xml file:

<intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="$URL_SCHEME"/> </intent-filter>

I need to remove the plugin, and add it back every time before compiling.
Any ideas why it could happen?

Using:
Cordova Android 9.1
Cordova 10

Thanks.

@WuglyakBolgoink
Copy link

@veronicatc never had this problem, are you sure that you don't remove the plugin or do some changes in manifest during compilation and build processes?

@veronicatc
Copy link
Author

veronicatc commented Aug 2, 2021

@WuglyakBolgoink I finally found that this was a problem caused by using edit-config in config.xml file. I was using merge, but it still removed the block.

I changed this in my config.xml:

<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']"> <activity android:theme="@style/Full" /> </edit-config>

to use cordova-custom-config plugin like this:

<custom-preference name="android-manifest/application/activity/@android:theme" value="@style/Full" />

and this fixed the issue.

I did this after finding this comment on a stackoverflow page, from 2018:

Though this is a good answer, and probably the best way to do it for 99% of circumstances I'd like to add a caveat. We use github.com/EddyVerbruggen/Custom-URL-scheme , it adds an intent to the AndroidManifest.xml. Using <edit-config file="AndroidManifest.xml" target="/manifest/application/activity" mode="merge"> <activity android:configChanges="keyboardHidden" /> </edit-config> Results in the intent being removed - you might need to find a different strategy

This is the link in case it is useful to anyone:

https://stackoverflow.com/questions/40446058/cordova-change-androidmanifest-using-config-xml-file

@WuglyakBolgoink
Copy link

@veronicatc great!

PS: can you please fix the link for SO too?

@veronicatc
Copy link
Author

@WuglyakBolgoink fixed!

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

No branches or pull requests

2 participants