sencha touch 2.3 with phonegap only default icons / splash - android

I'm running Sencha Touch 2.3 with Sencha Cmd v4.0.0.203. Phonegap 3.1.0-0.15.0.
the integration is running fine but my problem is that my icons / splash will not be used. i have defined it in config.xml eg. for icon
<icon gap:platform="ios" height="57" src="resources/icons/ios/icon.png" width="57" />
<icon gap:platform="ios" height="72" src="resources/icons/ios/icon-72.png" width="72" />
<icon gap:density="ldpi" gap:platform="android" src="resources/icon/android/icon-36-ldpi.png" />
<icon gap:density="mdpi" gap:platform="android" src="resources/icon/android/icon-48-mdpi.png" />
i'm running sencha app build native, the build process passed and the app is working on device but with default phonegap icons and splash. the icons will be copied to www/resources but in platform/ios/APP/Resources and platform/android/res the default icons are still existing.

Since you are using sencha command to build the application. You will have to manually place the icons under the platform/android/res folder. There is a bug in the phonegap-cli to get this working in local build.
https://github.com/phonegap/phonegap-cli/issues/58

Hey I was having the same issue, but with phonegap build.
If you have hydration enabled ( in phonegap build ), try disabling it. Rebuild all packages if it doesn't do it automatically.
It seems that with hydration enabled, it may not be doing a full rebuild everytime.
Once you get your icons and splash screens straightened out, you should be able to re-enable hydration.

Related

How to modify splash screen in phonegap project?

I have done below things to make a simple app just to open a mobile website inside app browser.
Installed Phone Gap Desktop App and created a project
Build using Phone Gap Build and downloaded APK for testing on mobile
Problem : Everything works well expect splash screen is showing
default CORDOVA ICON WITH GREY BACKGROUND
I have replaced all the splash screen image inside \res\screen\android
And updated my config.xml code as well
<platform name="android">
<!-- you can use any density that exists in the Android project -->
<splash src="res/screen/android/screen-hdpi-landscape.png" density="land-hdpi"/>
<splash src="res/screen/android/screen-ldpi-landscape.png" density="land-ldpi"/>
<splash src="res/screen/android/screen-mdpi-landscape.png" density="land-mdpi"/>
<splash src="res/screen/android/screen-xhdpi-landscape.png" density="land-xhdpi"/>
<splash src="res/screen/android/screen-hdpi-portrait.png" density="port-hdpi"/>
<splash src="res/screen/android/screen-ldpi-portrait.png" density="port-ldpi"/>
<splash src="res/screen/android/screen-mdpi-portrait.png" density="port-mdpi"/>
<splash src="res/screen/android/screen-xhdpi-portrait.png" density="port-xhdpi"/>
</platform>
<preference name="SplashScreenDelay" value="3000" />
In index.html using below script and it open the URL as expected but splash screen loading default cordova icon with grey background
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
window.open = cordova.InAppBrowser.open;
var ref2 = cordova.InAppBrowser.open(encodeURI('https://example.com'), '_blank', 'location=no');
navigator.splashscreen.show();
window.setTimeout(function () {
navigator.splashscreen.hide();
}, 3000);
}
Tried already posted solutions but none of them working for me.
Any help will be appreciated
It's not about cleaning or caching issues at all. The problem is PhoneGap includes all possible launch images in project template by default. These files are under Resources folder and copied to bundle's root folder on build event. Although I properly selected my own launch images in Xcode (Target/Summary screen), default PhoneGap's specific files e.g. Default~iphone.png overridden my files :(
Once issue is identified, you can fix it someway, but I prefer below steps:
Delete all default icons and splashscreen files under
/platforms/ios/AppName/icons and /splash folders. You surely don't
need these placeholder images.
In Xcode, select Targets/AppName, then tab Build Phases, delete all
file names of images in the above step in section Copy Bundle
Resources.
Add your own images files for app icon and launch images here.
Edit Info.plist file (file AppName-Info.plist under
/platforms/ios/AppName/) to include your images, you will need to
use CFBundleIcons and UILaunchImageFile keys. Go to iOS developer
site for reference.

Cordova - white screen after splash, no exceptions in console

I've been away from my Cordova app for a bit, but just did a fresh clone yesterday and noticed that it's got the "white screen of death" symptoms -- the splash screen displays, the program loads... and then I just get a blank screen. Some more details:
CLI: Cordova 6.1.1, android 5.1.1, ios 4.1.1
I'm not using any special plugins to display a splash screen -- just <splash> elements in my config.xml file.
This is happening in both iOS and Android, both on local builds and using PhoneGap Build (i.e., debug and release).
There are no exceptions of missing resources in the console, either in iOS (using Safari's dev tools) or Android (using Chrome's dev tools).
I've done a diff with my last known working build, and there's really nothing that pops out. I saw an undefined Underscore reference, but I backed that change out and it didn't resolve anything -- I think I'd see the exception in the console, anyway.
Has Cordova / PhoneGap done something recently that might be causing this? Any ideas on how to isolate this one? I'm really stumped.
Well that was ugly. It turned out that there was an exception being thrown, it was just being thrown too early for the browser dev tools to pick it up (Safari, Chrome for iOS and Android, respectively). The exception did show up when I ran things through the browser target (cordova platform add browser, etc.) So that browser platform is useful for something I guess. :-)
In my case, the cordova-sqlite-storage plugin had made a breaking API change that broke the code when I updated everything. The solution was to pin the plugin to an earlier version in the config.xml file.
So, lessons learned:
If you suspect there's an exception being thrown during startup, you can use the browser platform to track it down.
Pin your plugins to a specific version using the spec parameter in the config.xml. This will save you some heartache in the future.
[another option from #jcesarmobile, below] hitting refresh in the browser dev tools will also kick out the exception. Nice!
I'll be going back in to the config.xml and pinning the other items -- and doing some cleanup as suggested above. Thanks again, everyone.
I manged to run your app this are the steps I followed.
1) First you need to declare Splash screen preference along with splash screen plugin location in your config.xml. This is what I think you are missing
<preference
name="SplashScreen"
value="screen" />
<preference
name="AutoHideSplashScreen"
value="true" />
<preference
name="SplashScreenDelay"
value="5000" />
<feature name="SplashScreen" >
<param
name="android-package"
value="org.apache.cordova.splashscreen.SplashScreen" />
<param
name="onload"
value="true" />
</feature>
2) Declare your splash screens images in config.xml ,which you have already done.
I suggest you to keep images in default density folders of android project (ldpi,mdpi,hdpi,xhdpi etc) instead of screen/android folder as it will simplifiy your project structure.
<!-- you can use any density that exists in the Android project -->
<splash
density="land-hdpi"
src="res/drawable-land-hdpi/splash.png" />
<splash
density="land-ldpi"
src="res/drawable-land-ldpi/splash.png" />
<splash
density="land-mdpi"
src="res/drawable-land-mdpi/splash.png" />
<splash
density="land-xhdpi"
src="res/drawable-land-xhdpi/splash.png" />
<splash
density="port-hdpi"
src="res/drawable-hdpi/splash.png" />
<splash
density="port-ldpi"
src="res/drawable-ldpi/splash.png" />
<splash
density="port-mdpi"
src="res/drawable-mdpi/splash.png" />
<splash
density="port-xhdpi"
src="res/drawable-xhdpi/splash.png" />
</platform>
3) Add Splash screen plugin class into your android project structure under org.apache.cordova.splashscreen package or install splash screen Cordova plugin
https://cordova.apache.org/docs/en/3.1.0/cordova/splashscreen/splashscreen.html
4) Final and most important step you must have cordova.js in your www folder
And after that I was able to run your web app
I am android developer I guess something similar you might need to do for iOS
The only fix that worked for me was found here:
http://www.codingandclimbing.co.uk/blog/ionic-2-fix-splash-screen-white-screen-issue-14
basically edit your config.xml file. The splashscreen setup should look like this:
<preference name="ShowSplashScreen" value="true"/>
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="30000"/>
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="SplashShowOnlyFirstTime" value="false"/>
<preference name="FadeSplashScreen" value="false"/>
<feature name="SplashScreen">
<param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen"/>
</feature>
In my case, i put an ALERT before first screen still mounted.
I had a similar problem while using cordova with ember.js. It was about the url change strategy of my application.
Have a look on this answer, it maybe related with your problem.
Try adding this preference to your config.xml, maybe this is the problem
<preference name="AutoHideSplashScreen" value="true"/>
You should install the splash-screen plugin for both iOS and Android to work properly if you are adding splash in config.xml. or else without splash-screen plugin what you could try to do is making an splash screen with HTML, divide your body in 2 parts: content and login. Then you set the content style display: none. When the app is done loading you just set loading screen display: none and content screen display: block or whatever you want
And you missing below preferences in your config.xml
<preference name="SplashScreenDelay" value="3000" />
<preference name="SplashMaintainAspectRatio" value="true|false" />
<preference name="SplashShowOnlyFirstTime" value="true|false" />
A missing <meta http-equiv="Content-Security-Policy"> tag on the head caused a white-screen in my case.
I added these lines in config.xml
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="6000" />
I also have a black screen when I give screendelay as 3000.so I changed to 6000.I think cordova take some time to load your js,css and image files.
In my case, I accidentally commented the state definition in app.js.
My problem was with ES6, it runs perfectly on iPhone and Android 6, but it doesn't work with Android 4 and 5.
I have this situation and solved it.
In my case it was something similar to this code:
$scope.images.push({ id: i, src: "http://placehold.it/50x50" , pstb, trno});
The above code run well on android 7.0 but only white screen after splash on android 4.4.4
Changed to this:
$scope.images.push({ id: i, src: "http://placehold.it/50x50", pstb: pstb, trno: trno});
Run on all devices (at least all my devices)
Not really an answer, but I'll add it to the list of potential experiments here - I never worked out how this was happening, but it was resolved by deleting the entire platforms folder and node_modules, then re-adding the platform.
1>> If you suspect there's an exception being thrown during startup, you can use the browser platform to track it down.
2>>Pin your plugins to a specific version using the spec parameter in the config.xml. This will save you some heartache in the future.

Phonegap CLI builds for Android not showing splash screens

The Phonegap CLI documentation on the subject of Splashscreens and Icons suggests the following
SplashScreen (string, defaults to splash): The name of the file minus its extension in the res/drawable directory. Various assets must share this common name in various subdirectories.
<preference name="SplashScreen" value="mySplash"/>
I configured my Phonegap CLI project as follows
project folder
|
res
|
---port-ldpi.png
|
---land-ldpi.png
|
--- ...
|
--- land-xhdpi.png
With that done I wrote up my project level config.xml file
<preference name="SplashScreenDelay" value="12000"/>
<preference name="SplashScreen" value="screen"/>
<splash src="res/port-ldpi.png" density="port-ldpi"/>
<splash src="res/land-ldpi.png" density="land-ldpi"/>
<splash src="res/port-mdpi.png" density="port-mdpi"/>
<splash src="res/land-mdpi.png" density="land-mdpi"/>
<splash src="res/port-hdpi.png" density="port-hdpi"/>
<splash src="res/land-hdpi.png" density="land-hdpi"/>
<splash src="res/port-xhdpi.png" density="port-xhdpi"/>
<splash src="res/land-xhdpi.png" density="land-xhdpi"/>
I then issued a phonegap build android --release -d >> /tmp/result.txt and examined the output in /tmp/result.txt. I showed the following lines
copying image from /path/to/my/project/res/port-ldpi.png to
/path/to/my/project/platforms/android/res/drawable-port-ldpi/screen.png
copying image from /path/to/my/project/res/land-ldpi.png to
/path/to/my/project/platforms/android/res/drawable-land-ldpi/screen.png
.....
copying image from /path/to/my/project/res/land-xhdpi.png to
/path/to/my/project/platforms/android/res/drawable-land-xhdpi/screen.png
Finally, I examined the generated APK by opening it in 7-zip. In the res folder I found the following
drawable-port-ldpi-v4/screen.png
drawable-land-ldpi-v4/screen.png
...
drawable-land-xhdpi-v4/screen.png
The images beign the ones I supplied in my /project/res folder. Finally, I checked the output to ensure that it was terminating with a Command finished with error code 0: line.
I then installed my application and ran it - no splash screen.
For good measure - though it makes little sense as a requirement - I retried the above after wrapping the splash & icon bits of the config.xml file in a
<platform name='android'>
</platform>
section - it made no difference. The strange thing is that icons assigned in precisely the same way work perfectly. I wanted to be sure that I was in fact supplying a splash screen for the resolution of my Huwaei Holly phone where I was testing it all so I used slightly different icon images. The installation displayed the XHDPI icon so by rights when the app starts up it should display the XHDPI splash screen
This is a frequently discussed subject but I fail to see that I am doing something wrong here.
For completeness I should mention
Phonegap CLI version : 5.3.6
Tested on Honor Holly, Android version 4.4.2
I am posting the answer for the benefit of anyone running into this thread. The Cordova/Phonegap CLI documentation on the subject of splashscreens is very confusing. Here are a few tips to help you along
When you build the config.xml file you need to specify the locations of the various splashscreen images in the format <splash src="res/{$name}.9.png" density="{$name}"/>. The .9. is optional - use if if you are using 9 patch images
You also need to have the line <preference name="SplashScreen" value="screen"/>. This is invariant. Contrary to what the documentation seems to imply you have no choice over the value - screen and only screen will work.
The original location of the images does not matter - it is best to place it in a folder inside the project folder, res in my case. If you place it inside the www folder you end up with two copies of your image - one of which is never used.
When Phonegap CLI builds your project it will copy your images to platforms/android/res/drawable-port|land-??dpi-v4. I am not sure why v4 but that is the wya it is. It is these images that are used to show the splash screen
most important of all On the Android splash screens do not show up at startup automatically. For them to show up you must do two things
Include the cordova-plugin-splashscreen plugin in your project
Call navigator.splashscreen.show() - typically from the deviceReady event
Finally, to control the duration of the splash display you need to specify <preference name="SplashScreenDelay" value="..."/> where the value is in milliseconds.
It would help a lot of developers if the Cordova documentation had the grace to mention that on the Android the splashscreen does not display automatically.

How to add Splash screen in ionic cordova?

I have installed plug-in for splash screen,
$ ionic start myapp tabs
$ ionic plugin add org.apache.cordova.splashscreen
$ ionic platform add android
$ vi config.xml
Changed config file as the following
Put the following preference elements in config.xml:
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="1000" />
In the <platform name="android">, put the <splash> elements in, but DO NOT include the file extension:
<splash src="res/screen/android/640x960" density="mdpi"/>
<splash src="res/screen/android/768x1024" density="hdpi"/>
<splash src="res/screen/android/1536x2048" density="xhdpi"/>
Only it is showing the white splash screen. I do not know where I went wrong? Someone help me to come out?
Probably the value attribute. The value is the name of the specific image file being used as the splash in the resource folder. Sometimes its not called 'screen' but 'splash'.
To customize better you can also use resources in Ionic CLI
http://ionicframework.com/docs/cli/icon-splashscreen.html

Push notification shows default icon instead of the icon I setup in cordova config.xml

I have a ionic project in which I have set config.xml for android as follows
<icon src="src/res/icon/android/notification.png" />
<icon src="src/res/icon/android/icon-36-ldpi.png" density="ldpi" />
<icon src="src/res/icon/android/icon-48-mdpi.png" density="mdpi" />
<icon src="src/res/icon/android/icon-72-hdpi.png" density="hdpi" />
<icon src="src/res/icon/android/icon-96-xhdpi.png" density="xhdpi" />
After running ionic build android, I see the res/drawable folder in my platform/android folder and it shows that notification.png is inside the drawable folder as icon.png. I am using my own fork of phonegap PushPlugin, where I have set the notification icon to icon.png as
import com.project.mobile.R;
new NotificationCompat.Builder(context)
.setDefaults(defaults)
.setSmallIcon(R.drawable.icon)
.setWhen(System.currentTimeMillis())
.setContentTitle(extras.getString("title"))...
But when I test it on my device,I still see the default icon.png icon in the push notification bar. I have also tried putting notification.png in android's res/drawable folder and changing the code for Plugin to
.setSmallIcon(R.drawable.notification)
And it works. But I need a solution which can work where I just setup the config.xml such that I don't need to add a single file everytime I create a new build. I am using Ionic version 1.3.19 and cordova version 4.3.0. Ask any question If you need more clearification..

Categories

Resources