i decide work on phonegap write apps on multiple devices. every time try use plugin, works after lot of hours , hundreds , hundreds search on google... , time not working @ me. not understand basic knowledge of phonegap.
let's talk simple plugin, splash screen plugin (https://github.com/apache/cordova-plugin-splashscreen).
on plugin instruction, understand need write lines in config.xml:
<preference name="splashscreen" value="foo" /> <preference name="splashscreendelay" value="3000" /> <preference name="splashmaintainaspectratio" value="true|false" /> <preference name="splashshowonlyfirsttime" value="true|false" />
but if read instruction in link found in android part (http://cordova.apache.org/docs/en/dev/config_ref/images.html) should write these lines in config.xml:
<platform name="android"> <!-- can use density exists in android project --> <splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/> <splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/> <splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/> <splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/> <splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/> <splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/> <splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/> <splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/> </platform>
i tried both instruction , it's not working. found other instruction on phonegap build , suppose write these liens in config.xml:
<splash src="ldpi.png" platform="android" qualifier="ldpi" /> <splash src="mdpi.png" platform="android" qualifier="mdpi" /> <splash src="hdpi.png" platform="android" qualifier="hdpi" /> <splash src="xhdpi.png" platform="android" qualifier="xhdpi" /> <splash src="fr-xhdpi.png" platform="android" qualifier="fr-xhdpi" /> <splash src="portrait-xxhdpi.png" platform="android" qualifier="port-xxhdpi" /> <splash src="landscape-xxhdpi.png" platform="android" qualifier="land-xxhdpi" />
and confuse me more, if check "default" config.xml phonegap generates, found these lines:
<gap:splash src="www/res/screen/android/screen-ldpi-portrait.png" gap:platform="android" gap:qualifier="port-ldpi"/> <gap:splash src="www/res/screen/android/screen-mdpi-portrait.png" gap:platform="android" gap:qualifier="port-mdpi"/> <gap:splash src="www/res/screen/android/screen-hdpi-portrait.png" gap:platform="android" gap:qualifier="port-hdpi"/> <gap:splash src="www/res/screen/android/screen-xhdpi-portrait.png" gap:platform="android" gap:qualifier="port-xhdpi"/>
as can see, sometime source file starts 'www' or 'res', sometime have <splash>
inside <platform>
element or platform attribute of <splash>
element.
difference between <splash>
, <gap:splash>
element?
i'm confused instructions found in phonegap api, phonegap build api , plugin web page.
i'm using phonegap 5.3.9 on mac. test app using android phonegap app or using phonegap build (cli-5.2.0).
i started using cordova (the open source version of phonegap) , struggled. however, there's few things learned think may make things more clear you.
phonegap meant make code on multiple platforms (ios, android, etc). files see in 'platforms' directory meant specific platforms. should edit these files if want make changes specific platform won't affect other platforms. each platform has own config.xml file uses in addition config file found in project root folder. assuming you're not trying make splash screen android want same across every platform, should edit config.xml found in project root folder.
i try using 1st , 3rd blocks of code posted. 2nd 1 android specific customization. , i'm not sure 4th one.
as not working, recommend use debugger pinpoint not working. debugging android, used chrome remote debugging: https://developer.chrome.com/devtools/docs/remote-debugging
from there, can @ console logs , tell plugin not being loaded. , if not, has few tools can use pinpoint why plugin isn't working (breakpoints, log statements).
hope helps! if not, can ask me , might able offer further advice.
Comments
Post a Comment