2016-09-21 40 views
0

我正在尋找一種方法來控制我的飛濺屏幕顯示的時間。由於我必須在用戶可以與UI進行交互之前下載數據,因此這一次不是固定的。 我的問題是,我不能夠防止在啓動畫面被Android上的自動隱藏,在iOS上我做到了將要對我​​3210如何防止飛濺屏幕使用科爾多瓦splashscreen插件(離子)在Android上自動隱藏

<feature name="SplashScreen"> 
    <param name="ios-package" value="CDVSplashScreen"/> 
    <param name="onload" value="true" /> 
</feature> 

這是我​​3210

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<widget id="com.example.my" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> 
    <name>my example</name> 
    <description> 
     an example app 
    </description> 

    <content src="index.html"/> 
    <access origin="*"/> 
    <preference name="webviewbounce" value="false"/> 
    <preference name="UIWebViewBounce" value="false"/> 
    <preference name="DisallowOverscroll" value="true"/> 
    <preference name="android-minSdkVersion" value="19"/> 
    <preference name="BackupWebStorage" value="none"/> 
    <preference name="SplashScreenDelay" value="5000" /> 
    <preference name="auto-hide-splash-screen" value="false" /> 
    <preference name="AutoHideSplashScreen" value="false" /> 
    <preference name="orientation" value="portrait"/> 
    <preference name="SplashMaintainAspectRatio" value="true"/> 
    <feature name="StatusBar"> 
    <param name="ios-package" onload="true" value="CDVStatusBar"/> 
    </feature> 
    <feature name="SplashScreen"> 
     <param name="ios-package" value="CDVSplashScreen"/> 
     <param name="onload" value="true" /> 
    </feature> 
<feature name="SplashScreen"> 
     <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen"/> 
      <param name="onload" value="true" /> 
</feature> 
    <platform name="android"> 
    <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"/> 
    <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"/> 
    </platform> 
    <platform name="ios"> 
    <splash src="resources/ios/splash/[email protected]~iphone.png" width="640" height="1136"/> 
    <splash src="resources/ios/splash/Default-667h.png" width="750" height="1334"/> 
    <splash src="resources/ios/splash/Default-736h.png" width="1242" height="2208"/> 
    <splash src="resources/ios/splash/[email protected]~ipad.png" width="1536" height="2048"/> 
    <splash src="resources/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/> 
    <splash src="resources/ios/splash/[email protected]~iphone.png" width="640" height="960"/> 
    <splash src="resources/ios/splash/Default~iphone.png" width="320" height="480"/> 
    <icon src="resources/ios/icon/icon.png" width="57" height="57"/> 
    <icon src="resources/ios/icon/[email protected]" width="114" height="114"/> 
    <icon src="resources/ios/icon/icon-40.png" width="40" height="40"/> 
    <icon src="resources/ios/icon/[email protected]" width="80" height="80"/> 
    <icon src="resources/ios/icon/[email protected]" width="120" height="120"/> 
    <icon src="resources/ios/icon/icon-50.png" width="50" height="50"/> 
    <icon src="resources/ios/icon/[email protected]" width="100" height="100"/> 
    <icon src="resources/ios/icon/icon-60.png" width="60" height="60"/> 
    <icon src="resources/ios/icon/[email protected]" width="120" height="120"/> 
    <icon src="resources/ios/icon/[email protected]" width="180" height="180"/> 
    <icon src="resources/ios/icon/icon-72.png" width="72" height="72"/> 
    <icon src="resources/ios/icon/[email protected]" width="144" height="144"/> 
    <icon src="resources/ios/icon/icon-76.png" width="76" height="76"/> 
    <icon src="resources/ios/icon/[email protected]" width="152" height="152"/> 
    <icon src="resources/ios/icon/[email protected]" width="167" height="167"/> 
    <icon src="resources/ios/icon/icon-small.png" width="29" height="29"/> 
    <icon src="resources/ios/icon/[email protected]" width="58" height="58"/> 
    <icon src="resources/ios/icon/[email protected]" width="87" height="87"/> 
    </platform> 
    <icon src="resources/android/icon/drawable-xhdpi-icon.png"/> 
    <plugin name="com.telerik.plugins.nativepagetransitions" spec="~0.6.5"/> 
    <plugin name="phonegap-plugin-push" spec="~1.8.1"> 
    <variable name="SENDER_ID" value="xxxxxxxxx"/> 
    </plugin> 
    <plugin name="cordova-plugin-console" spec="~1.0.3"/> 
    <plugin name="cordova-plugin-splashscreen" spec="~3.1.0"/> 
    <plugin name="cordova-plugin-badge" spec="~0.7.2"/> 
</widget> 

有沒有一個特殊的參數/功能,我必須添加到我的​​3210?

編輯: 如果我改變SplashScreenDelay值,這也打破了閃屏需要隱藏在iOS後,我送navigator.splashscreen.hide();

回答

0

我解決了這個問題加入不同每個平臺標籤

內的喜好
<platform name="android"> 
    <preference name="StatusBarBackgroundColor" value="#93bc26" /> 
    <preference name="android-minSdkVersion" value="19" /> 
    <preference name="SplashScreenDelay" value="50000" /> 
    <preference name="SplashMaintainAspectRatio" value="true" /> 
    <preference name="SplashShowOnlyFirstTime" value="false" /> 
</platform> 
<platform name="ios"> 
    <preference name="SplashScreenDelay" value="1000" /> 
    <preference name="deployment-target" value="7.0"/> 
</platform> 

編輯: 這是完整的代碼:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
    <widget id="com.example.my" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> 
    <name>my example</name> 
    <description>an example app 
    </description> 

<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="auto-hide-splash-screen" value="false" /> 
<preference name="AutoHideSplashScreen" value="false" /> 
<preference name="SplashScreen" value="screen" /> 
<preference name="FadeSplashScreenDuration" value="1000" /> 
<preference name="orientation" value="portrait" /> 
<feature name="StatusBar"> 
    <param name="ios-package" onload="true" value="CDVStatusBar" /> 
</feature> 
<platform name="android"> 
    <preference name="StatusBarBackgroundColor" value="#93bc26" /> 
    <preference name="android-minSdkVersion" value="19" /> 
    <preference name="SplashScreenDelay" value="50000" /> 
    <preference name="SplashMaintainAspectRatio" value="true" /> 
    <preference name="SplashShowOnlyFirstTime" value="false" /> 
    <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" /> 
    <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" /> 
    <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" /> 
    <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" /> 
    <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" /> 
    <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" /> 
    <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" /> 
    <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" /> 
    <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" /> 
    <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" /> 
    <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" /> 
    <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" /> 
</platform> 
<platform name="ios"> 
    <preference name="SplashScreenDelay" value="1000" /> 
    <preference name="deployment-target" value="7.0" /> 
    <splash height="1136" src="resources/ios/splash/[email protected]~iphone.png" width="640" /> 
    <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" /> 
    <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" /> 
    <splash height="2048" src="resources/ios/splash/[email protected]~ipad.png" width="1536" /> 
    <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" /> 
    <splash height="960" src="resources/ios/splash/[email protected]~iphone.png" width="640" /> 
    <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> 
    <icon height="57" src="resources/ios/icon/icon.png" width="57" /> 
    <icon height="114" src="resources/ios/icon/[email protected]" width="114" /> 
    <icon height="40" src="resources/ios/icon/icon-40.png" width="40" /> 
    <icon height="80" src="resources/ios/icon/[email protected]" width="80" /> 
    <icon height="120" src="resources/ios/icon/[email protected]" width="120" /> 
    <icon height="50" src="resources/ios/icon/icon-50.png" width="50" /> 
    <icon height="100" src="resources/ios/icon/[email protected]" width="100" /> 
    <icon height="60" src="resources/ios/icon/icon-60.png" width="60" /> 
    <icon height="120" src="resources/ios/icon/[email protected]" width="120" /> 
    <icon height="180" src="resources/ios/icon/[email protected]" width="180" /> 
    <icon height="72" src="resources/ios/icon/icon-72.png" width="72" /> 
    <icon height="144" src="resources/ios/icon/[email protected]" width="144" /> 
    <icon height="76" src="resources/ios/icon/icon-76.png" width="76" /> 
    <icon height="152" src="resources/ios/icon/[email protected]" width="152" /> 
    <icon height="167" src="resources/ios/icon/[email protected]" width="167" /> 
    <icon height="29" src="resources/ios/icon/icon-small.png" width="29" /> 
    <icon height="58" src="resources/ios/icon/[email protected]" width="58" /> 
    <icon height="87" src="resources/ios/icon/[email protected]" width="87" /> 
</platform> 
<icon src="resources/android/icon/drawable-xxxhdpi-icon.png" /> 
<plugin name="com.telerik.plugins.nativepagetransitions" spec="~0.6.5" /> 
<plugin name="cordova-plugin-console" spec="~1.0.3" /> 
<plugin name="cordova-plugin-splashscreen" spec="~3.1.0" /> 
<plugin name="cordova-plugin-badge" spec="~0.7.2" /> 
<plugin name="cordova-plugin-statusbar" spec="~2.2.0" /> 
<plugin name="phonegap-plugin-push" spec="~1.8.2"> 
    <variable name="SENDER_ID" value="xxxxxxxxx" /> 
</plugin> 
<plugin name="cordova-plugin-network-information" spec="~1.3.0" /> 

+0

你介意再次發佈你的完整config.xml嗎?我遇到了類似的問題,但我所做的更改似乎無法解決問題。 – Birk

+0

@Birk我添加了我的完整config.xml – distante

0

嘗試添加下一個參數時:

<preference name="SplashShowOnlyFirstTime" value="false" /> 
0

正如我可以從你的​​3210收集你正在使用[email protected]你應該更新插件。

讀取該插件的Release Notes 3.2.0應該已經爲您提供了所需的信息。據我所看到的,有兩個bug fixes3.2.0發佈,關於您的問題...

CLI

更新應該給你最新的插件版本:

cordova plugins remove cordova-plugin-splashscreen 
cordova plugins add cordova-plugin-splashscreen 
+0

奇怪,科爾多瓦CLI不會說這是一個新的版本比我的。 – distante

+0

試試這個:'cordova plugin add [email protected] --save'。科爾多瓦對他們的CLI做了同樣的改變,我還不習慣它 – Beat

相關問題