Pracuję nad aplikacją mobilną, korzystając z Ionic Framework (opartego na Cordova).Ionic/Cordova: Dodaj filtr intencyjny za pomocą pliku config.xml
W systemie Android rejestruję aplikację, aby otworzyć pliki * .txt. Robię to dodając filtr intencji na platformach/android/AndroidManifest.xml i to działa. Ale folder platformy znajduje się w .gitignore: Chcę to zrobić za pomocą pliku config.xml.
Próbowałem dodając config.xml:
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/*/application/activity">
<intent-filter><!-- ... --></intent-filter>
</config-file>
<!-- ... -->
</platform>
Próbowałem również dodając:
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:name="CordovaApp">
<intent-filter><!-- ... --></intent-filter>
</activity>
</config-file>
<!-- ... -->
</platform>
Potem próbowałem zaktualizować AndroidManifest uruchomienie
ionic prepare
czy także:
ionic remove platform android && ionic add platform android
Ale AndroidManifest.xml jest zawsze niezmieniony. Co robię źle?
Używam Ionic 1.3.2 i Cordova 4.2.0.
Edit tu cały config.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<widget id="com.ionicframework.myapp551932" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>MyApp</name>
<description>
myApp
</description>
<author email="[email protected]" href="http://www.example.com/">
A Team
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="webviewbounce" value="false"/>
<preference name="UIWebViewBounce" value="false"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="BackupWebStorage" value="none"/>
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000"/>
<feature name="StatusBar">
<param name="ios-package" value="CDVStatusBar" onload="true"/>
</feature>
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application/activity">
<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="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.txt" />
<data android:host="*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:pathPattern=".*\\.txt" />
<data android:mimeType="*/*" />
</intent-filter>
</config-file>
<icon src="resources/android/icon/drawable-ldpi-icon.png" density="ldpi"/>
<icon src="resources/android/icon/drawable-mdpi-icon.png" density="mdpi"/>
<icon src="resources/android/icon/drawable-hdpi-icon.png" density="hdpi"/>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" density="xhdpi"/>
<icon src="resources/android/icon/drawable-xxhdpi-icon.png" density="xxhdpi"/>
<icon src="resources/android/icon/drawable-xxxhdpi-icon.png" density="xxxhdpi"/>
<splash src="resources/android/splash/drawable-land-ldpi-screen.png" density="land-ldpi"/>
<splash src="resources/android/splash/drawable-land-mdpi-screen.png" density="land-mdpi"/>
<splash src="resources/android/splash/drawable-land-hdpi-screen.png" density="land-hdpi"/>
<splash src="resources/android/splash/drawable-land-xhdpi-screen.png" density="land-xhdpi"/>
<splash src="resources/android/splash/drawable-land-xxhdpi-screen.png" density="land-xxhdpi"/>
<splash src="resources/android/splash/drawable-land-xxxhdpi-screen.png" density="land-xxxhdpi"/>
<splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
<splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
<splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
<splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
<splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
<splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
</platform>
<icon src="resources/android/icon/drawable-xhdpi-icon.png"/>
</widget>
można pokazać całą swoją 'config.xml' lub przynajmniej nagłówek pliku xml? –
Tutaj jest (wszystko dodane przez Ionic za wyjątkiem znacznika pliku konfiguracyjnego). –