2016-09-21 38 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

相关问题