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