I'm developing a mobile game which needs WebGL to perform well, however WebGL only works on certain devices.
I have a Nexus 10 tablet updated to the most recent Android Lollipop.
My game uses WebGL when I run it from Chrome, however when I package the game using cordova the game doesn't use WebGL and is very slow. I've tested the behavior on several other devices as well:
WebGL Works:
Samsung Galaxy S5 (4.4.4)
Blackberry Priv (6.0.1)
WebGL Doesn't work
Nexus 10 (5.1.1)
Samsung Galaxy S3 (4.3)
iPad mini 1 (9.3.5)
Samsung Galaxy Tab 3 (4.4.2)
I've also tried using CrossTalk but the app it created never starts. After the splash screen it has black background and nothing happens.
How can I fix or debug the issue that WebGL doesn't work on certain devices?
I managed to make it work, The main reason for not using WebGL is some devices that doesn't have a certain feature in the GPU is by default disable WebGL. The only way to force using WebGL, you will need to use CrossWalk and at same time ignore gpu blacklist.
First I added CrossWalk plugin using the following command:
cordova plugin add cordova-plugin-crosswalk-webview
Then I modified the config.xml to contain this part
<preference name="xwalkCommandLine" value="--ignore-gpu-blacklist" />
Also I signed the APK for release and that made the App work.
Adding this preference forced my Nexus 10 to use WebGL and its super fast.
Also CrossWalk is very fast and made the app work better on my new BlackBerry Priv.
Related
I have a small web app built on top of fabricjs, with gestures enabled, very similar to the gesture demos on fabricjs tutorial site.
The app draws an image (jpg, 2000x2000) using another image (png, 2500x2500) as a mask.
The web app works flawlessly on desktop PC and in the iPhone; it is slower on Android phones; that's fine, I was expecting this behaviour.
The weird thing is that the same js, on the same device, works much faster under firefox than under chrome.
This behaviour is the same on every android release (tested on android 4.4, 5,x, 6.x) and it's the same on every Android device (tested many, say galaxy note 10.1 2014ed, galaxy note 2, honor 8).
Can you give me any hint? Why chrome, on canvas operations, is consistently slower than firefox?
Thanks!
So, I did a video-game in UE 4.8 and compiled it for Android.
It’s a game for training mathematical abilities in first and second
graders, using Android tablets. However, the game won’t run in the
tablets we are using for the training program. After installing the
APK, when I try to run the game, it immediately closes and a sign
appears saying: “The application has stopped”. I installed the
application in other several android devices and it works fine (e.g.
LG F60, Samsung Galaxy S5). However, I need to make it work for this
particular tablet, because those are the ones we are using for the
training program and we have like 80 of them. The tablet is a
ProntoTec X1, these are the specs:
CPU: All winner A31s Quad Core-Cortex A7, 1.2GHZ;
OS: 4.4 KitKat;
RAM: 1G DDR3;
10.1-inch screen, 1024 x 600 Pixels
I’ve tried different things, like compiling an empty project, but is the same: it works on other devices, but not on these tablets. I also compiled the game using different API versions of the SDK and NDK, but that didn’t help either. These are the versions that I’m currently using: ndk-r10e, ant-1.9.6, jdk-1.7.0, sdk platform-19 (android studio 1.2.2).
Please, any suggestion is welcome. Thanks!
Take a look at the droid versions supported, also have a look at the droid permissions, I had this issue some time ago and the permissions is what did it for me.
I have developed an application which uses Cordova/Phonegap on Android to display Open Layers 3 maps.
It is quite similar to this project:
https://github.com/netgis/ol3
I have found that the application runs smoothly on the Samsung Note 4 running Kitkat V4.4.4, and runs fine on an old S2 running Jellybean (almost equally well in fact), but it runs terribly slowly on a bran new Galaxy Tab Pro 12.2 running KitKat V4.4.2.
I was wondering if there is any Cordova/Phonegap expert out there who might know why.
The only difference between them that I can see is the version of android! V4.4.4 and V4.4.2.
I have discovered threads on SO which generically say that WebView can be a problem and cause slow performance, but I'm getting great performance on my Note 4, and the S2 runs better than the tablet does using Jellybean.
I'm not sure code would be useful to show here, essentially I have a Cordova Android application with a single HTML document with Open Layers 3 map embedded, that's it.
The problem turns out to lie with WebView, which uses the default Android browser. For some reason this browser restricts CPU support if you're trying to use GPU acceleration (enabled by default), but doesn't provide GPU acceleration itself (it's really strange but true).
Apparently KitKat has this problem prior to Android V4.4.3. So if you're running V4.4.4 you won't encounter this performance problem as it has been fixed (as it uses Chromium instead of the default browser).
Here's one of many references I've found which corroborate this:
https://code.google.com/p/chromium/issues/detail?id=315111
Some devices haven't yet been updated to this level, here are my completely up to date devices:
The tablet uses Android V4.4.2
The S2 uses Android V4.0.2
The Note 4 uses Android V4.4.4
The S2 uses Jelly Bean and is therefore fine, the Note 4 uses the updated KitKat and also runs fine, but the tablet struggles with the application to such an extent it is unusable owing to it being below V4.4.3.
For me, the majority of suggested solutions on SO are to disable hardware acceleration, but these suggestions are unsuitable as my application really does require hardware acceleration to render maps efficiently.
The solution is to take this problem away completely by forcing the use of Chromium irrespective of the OS Version through the use of Crosswalk.
There are plenty of resources I've found to use Cordova in synergy with crosswalk:
https://crosswalk-project.org/documentation/cordova.html
https://blog.nraboy.com/2014/10/use-crosswalk-ionic-framework-android-apps/
I've create an android aplication using phonegap and jquery mobile, when I test it from android version Gingerbread (2.3.3) everything is fine, but when I run my application on android phone with android version ICS (4.0.2), all images not showing. why my images not showing in android phone with ICS? and VideoRecording functions too not works in higher version well.
here is the sample code: http://pastie.org/4201837
I have also had a lot of issue with phonegap and ICS. The reason for this is due to the fact that their are a lot of Web View Bugs within the ICS firmware.
This is mainly due to the fact that Google want more native apps and therefore have not bothered properly supporting web view apps, such as phonegap.
They are slowly working through the more major issues. How are you currently displaying the images, like below?
<img src="test.png" />
After I have compiled and deployed the demo application to my Samsung Galaxy S II I noticed that the Sample PhoneGap App which comes with PhoneGap was not very responsive when pressing buttons and scrolling.
I also made a little app using PhoneGap and jQuery Mobile, with 4 buttons everything was ok, but when I added more than 7 and my viewport needed to be scrolled, scrolling become to be very slow, the more buttons/widgets I had the slower the srolling was.
Is this a bug specific to my mobile device or it is just how PhoneGap works:
The fact that PhoneGap apps feel slow on my phone including the demo?
EDIT:
The same PhoneGap app served by an HTTP server from my laptop and launched in the standard Android browser works very smoothly
Try setting your targetSdkVersion higher. Changing mine from "8" (i.e. Android 2.2) to "14" (Android 4.0) dramatically improved PhoneGap performance on phones running newer versions of Android. Most likely this enables certain performance-enhancing features such as hardware graphics acceleration.
For more info see my other answer about this here: https://stackoverflow.com/a/12397768/233370
Since PhoneGap and the frameworks that is used with it (JQM,Sencha Touch etc) are just working in a WebKit browser they can be slow if there's too much to render.
There's actually no bug with your device or etc.It's just that PhoneGap and the frameworks are not so good if you want fast response and so on.You can try your app in other devices and can observe that they behave the same.
I had the same Problems, after Update to Android 4.0.4 my Phonegap (Cordova 2.0.0) & Sencha Touch 2 - APP was very very slow.
But after I insert
super.appView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
the APP works fine, as before the update.
http://developer.android.com/guide/topics/graphics/hardware-accel.html
For improved performance you may not need Phonegap.
If what you need is quick cross platform styling but fast native components try a tool like nativecss.com It keeps the styling in CSS, but uses native components for everything else - so no HTML rendering delays or clunky animations.