Android FPS increases when touching view and decreases when not touched - java

I know this is a really odd problem. But has happened both on my Nexus S and Galaxy Tab.
When i drag on the view FPS increases to MAX FPS however if I don't it'll start fluctuating from 45-60. I've already tried tested simulations and it isn't the batching. I am using Open GL and there are no memory leaks. Any ideas?
This happens on all projects.

Are you using Jelly Bean? They added a new feature, as part of Project Butter, that might explain this.
Jelly Bean has more reactive and uniform touch responses, and makes
your device even more responsive by boosting your device's CPU
instantly when you touch the screen, and turns it down when you don't
need it to improve battery life.
http://www.android.com/about/jelly-bean/

Related

Animations are laggy on KitKat but smooth on Lollipop and up

I'm animating the movement of multiple views like this (basically just using y positioning):
View.animate()
.setInterpolator(new FastOutSlowInInterpolator())
.y(requiredCalculatedPosition)
.setDuration(400);
But the snippet has visible lags in KitKat and below while running buttery smooth on Lollipop+. (Only tested on emulators till now, with graphics managed by my GPU).
Android literally sucks when it comes to animating multiple UI views simultaneously in pre Lollipop versions. I managed to make things smoother by adding little delays in my animations, but I was unable to get rid of total animation flicker when animating more than one view. Also another thing - it also depends on device, usually flickering would appear in cheap devices with weak GPU like Acer or Asus tablets or so due to their GPU limitations. Generally it will work well in most devices like older Samsung Galaxy S2, S3. Also emulators can't emulate GPU well - this is a thing I find always disappointing compared to iOS emulators.

How to Hide Android Application from Task Manager/ not recent apps tab

I'm using a SG Note 4 and when I open the Google Maps app and then go to task manager it never shows up, it does when you go to settings, applications, cached..., how can I achieve the same with my app. Im using a map fragment and when moving the camera the cache increases and increases, I imagine people with little knowledge going to task manager and seeing my app using 500mb of ram might end up getting scared and kill it, or worse uninstalling it. Maybe not all manufacturers give users this option but for those that do how can I do this if it's even possible thanks!!

Android - evaluate device performance in app/game

I just started using libgdx to develop android games and i'm currently developing a game which would adjust the quantity and/or quality of the enemies/animations/drops/etc shown in the screen, depending on how many the device supports.
Some devices may be faster and support a greater amount of enemies, but others may begin to lag and i wanted to prevent that by disabling some options of the game, without any user interaction.
But i'm facing a problem: i don't know how to evaluate the device RAM, GPU, etc. and even if i did, i don't know how many enemies i can have given the device specifications.
Is there any way to estimate how many enemies/animations/drops/etc i can have for a device?

Android animating a button using PNGs and OOM

So I've tried going about animating a button through the example given in this example: Android Developers
and have made a huge (95 pictures) anim-list with Pngs. When trying to run the app and pressing the button, I promptly receive an error about memory not being sufficient. The file sizes are about 170k (12mb in total) . Is this too much for an animation? I realize the serious lack of regard for eventual users' storage space with this approach, but it's mostly for my own use anyway and won't matter.
The images are pretty big and need to be downscaled by the graphics engine however, and this might have to do with it?
Or is 95 pictures too much ? I can make the pictures smaller, right now they're at a whopping 4K resolution, which in hindsight is pretty dumb.
However, I can compress the pictures and make them smaller from the beginning anyway so that's not a problem. I just need to know how to fix this issue, if there's a treshold for how much can be loaded into RAM at a specific time so i can match the image sizes or if there's a way to override the default RAM settings or overcome this?
Don't look at the file size. Image has to be uncompressed so Android can use it. The image size is more or less equal to width*height*4. 4K image takes ~35MB of memory.
Modern devices can allocate 64MB of memory per app. It means that you can load only one such image. Maybe more if your phone has higher heap limit.
AnimationDrawable is for small animations (like 100x100px). If you wish to play such a large animation, you should encode it to mp4. If you can make the images smaller or make the animation procedural - go for it.
To override the memory limit use 'largeHeap' flag or change the setting in the ROM configuration (you have to flash your device with a custom ROM).

Android game special requirements

I'm making a game for android (inspired by brickbreaker), and am just finishing it up.
Thinking about special android requirements for the game, such as how to handle the various screen sizes, or not needing a back button.
What are other things i should be thinking about?
Have you also considered:
Screen rotation
When the process goes into the background
Checking for memory leaks
Distribution (perhaps in a later stage of development)
Operating system specifics
Good luck with your project!

Categories

Resources