Touchgui/plugins/org.apache.cordova.splashscreen/doc/index.md

Thu, 04 Jun 2015 14:50:33 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 04 Jun 2015 14:50:33 +0200
changeset 0
e8ccd40d0ef6
permissions
-rw-r--r--

Genesis of lecture sources for Droidcon Berlin 2015 in Postbahnhof.

michael@0 1 <!---
michael@0 2 Licensed to the Apache Software Foundation (ASF) under one
michael@0 3 or more contributor license agreements. See the NOTICE file
michael@0 4 distributed with this work for additional information
michael@0 5 regarding copyright ownership. The ASF licenses this file
michael@0 6 to you under the Apache License, Version 2.0 (the
michael@0 7 "License"); you may not use this file except in compliance
michael@0 8 with the License. You may obtain a copy of the License at
michael@0 9
michael@0 10 http://www.apache.org/licenses/LICENSE-2.0
michael@0 11
michael@0 12 Unless required by applicable law or agreed to in writing,
michael@0 13 software distributed under the License is distributed on an
michael@0 14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
michael@0 15 KIND, either express or implied. See the License for the
michael@0 16 specific language governing permissions and limitations
michael@0 17 under the License.
michael@0 18 -->
michael@0 19
michael@0 20 # org.apache.cordova.splashscreen
michael@0 21
michael@0 22 This plugin displays and hides a splash screen during application launch.
michael@0 23
michael@0 24 ## Installation
michael@0 25
michael@0 26 cordova plugin add org.apache.cordova.splashscreen
michael@0 27
michael@0 28
michael@0 29 ## Supported Platforms
michael@0 30
michael@0 31 - Amazon Fire OS
michael@0 32 - Android
michael@0 33 - BlackBerry 10
michael@0 34 - iOS
michael@0 35 - Windows Phone 7 and 8
michael@0 36 - Windows 8
michael@0 37
michael@0 38
michael@0 39 ## Methods
michael@0 40
michael@0 41 - splashscreen.show
michael@0 42 - splashscreen.hide
michael@0 43
michael@0 44 ### Android Quirks
michael@0 45
michael@0 46 In your config.xml, you need to add the following preferences:
michael@0 47
michael@0 48 <preference name="SplashScreen" value="foo" />
michael@0 49 <preference name="SplashScreenDelay" value="10000" />
michael@0 50
michael@0 51 Where foo is the name of the splashscreen file, preferably a 9 patch file. Make sure to add your splashcreen files to your res/xml directory under the appropriate folders. The second parameter represents how long the splashscreen will appear in milliseconds. It defaults to 3000 ms. See [Icons and Splash Screens](http://cordova.apache.org/docs/en/edge/config_ref_images.md.html)
michael@0 52 for more information.
michael@0 53
michael@0 54 ## splashscreen.hide
michael@0 55
michael@0 56 Dismiss the splash screen.
michael@0 57
michael@0 58 navigator.splashscreen.hide();
michael@0 59
michael@0 60
michael@0 61 ### BlackBerry 10, WP8, iOS Quirk
michael@0 62
michael@0 63 The `config.xml` file's `AutoHideSplashScreen` setting must be
michael@0 64 `false`. To delay hiding the splash screen for two seconds, add a
michael@0 65 timer such as the following in the `deviceready` event handler:
michael@0 66
michael@0 67 setTimeout(function() {
michael@0 68 navigator.splashscreen.hide();
michael@0 69 }, 2000);
michael@0 70
michael@0 71 ## splashscreen.show
michael@0 72
michael@0 73 Displays the splash screen.
michael@0 74
michael@0 75 navigator.splashscreen.show();
michael@0 76
michael@0 77
michael@0 78 Your application cannot call `navigator.splashscreen.show()` until the app has
michael@0 79 started and the `deviceready` event has fired. But since typically the splash
michael@0 80 screen is meant to be visible before your app has started, that would seem to
michael@0 81 defeat the purpose of the splash screen. Providing some configuration in
michael@0 82 `config.xml` will automatically `show` the splash screen immediately after your
michael@0 83 app launch and before it has fully started and received the `deviceready`
michael@0 84 event. See [Icons and Splash Screens](http://cordova.apache.org/docs/en/edge/config_ref_images.md.html)
michael@0 85 for more information on doing this configuration. For this reason, it is
michael@0 86 unlikely you need to call `navigator.splashscreen.show()` to make the splash
michael@0 87 screen visible for app startup.
michael@0 88

mercurial