How to decrease usage of battery in android - android

I was developing a voip calling android application using pjsip sdk.
In my app am using PARTIAL_WAKE_LOCKS,ALARMS,SERVICES.
When making calls battery is decreasing more drastically.
What do I do to preserve battery life in this scenario?

Since your question is too broad, it's complicated to help you.
You really should use Android Studio tools to see where your battery life is getting hurt.
I really really recommend checking this channel, with battery improvements patterns: Link here
The videos I recommend are:
https://www.youtube.com/watch?v=81W61JA6YHw&index=24&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE
https://www.youtube.com/watch?v=fEEulSk1kNY&index=28&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE
https://www.youtube.com/watch?v=4D7_N2XEw20&index=57&list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE

The only reason I see why your battery is decreasing faster is that the SDK you are using is not optimized. I mean the code that is executed inside the SDK is the reason your battery is decreasing so fast.
One solution would be to use another SDK,
Another one is to create your application from scratch and be careful about optimizing your code so that the application won't eat all your battery.

Related

How to test android library affect application's performance?

I am building some android application. And of course it use many library included in gradle.
I want to do performance test, which library can affect much my application performance for doing other logic , like encode and decode, or other stuff.
Any idea?
There's an entire section in the Android User Guide called Profile Your App. There's a number of tools you can use to measure the performance of your app, however an extensive performance testing will probably be time consuming. Normally you'd have to identify a problem in your app and pick appropriate profiling techniques to find out what causes it.
To add to #Egor's answer about profiling, you may also want to think about the method count limit when considering library dependencies, in particular on older devices. While not directly related to runtime performance, having to use multidex in your builds will significantly increase your build times and the initial loading time of your app (on Android older than Lollipop).

Performance Testing Tools for Mobile Applications

I am testing the application on Android & iOS platforms. The application uses the device mic. Network usage is used persistent.
Can any one suggest a simple Performance Testing tool to test the following,
I need to monitor & analyse the Network Usage
I need to analyse the Battery Consumption
Need to list down the scenarios when Memory Loss occurs
Generating the reports for the above mentioned scenarios would be much appreciated.
For battery consumption monitoring on Android you can use Battery Historian.
It provides detailed information, uses JavaScript visualization libraries to display battery related events on a timeline with panning and zooming functionality
You should be using AT&Ts ARO tool for deep network usage
analysis
You should be using Battery Historian for analysis of
Battery usage
You need to leverage a set of tools to find the right Memory Loss scenarios.
Its been an old post but thought I shall mention the tools that I have been using:
mAutomate (They have been providing lots of performance graphs for memory/CPU/Network etc)
Robotium (I had to write hell lot of code for it :) & was not automated)
I have used these tools for Android Test automation. mAutomate works for iOS too ,not sure about Robotium.
You should take a look at latest native Android Studio Profiler. It contains necessary tools for your purposes and they are often upgraded. Also for working with network I would like you to recommend Charles Proxy

Android performance meter

I looking a tools that can be helps for me to measure my performance in some parts of code in my android application.
Is there any tools for help me?
Now i was written a class that measure my functions in app, but may be is exist more effective methods?
I'm not sure if you are looking for a tool to instrument your code and review your stack trace execution time or something more related to different metrics, but maybe I can help. I'm working on a tool we will release soon, this tool will allow us to monitor our application performance in production using real-time stats. The platform is named FlowUp http://flowup.io/. Just adding an Android library to your project you could monitor your application in production in real-time :)
Using FLowUp you can get information about your application performance in terms of:
Frame time.
Frames per second.
Network consumption.
CPU usage.
Disk usage.
Memory consumption in terms of load and bytes allocated.
And much more metrics. Of course, all these metrics can be reviewed crossing this information with some tags related to the application or the device. For example, you could get information about the network consumption or the frames per second of your app per activity and comparing different app or Android OS version.
This is an screenshot I've taken from our landing page:
Right now we are under development but I recommend you to subscribe to our mail list in http://flowup.io to have access to the first beta we will release soon :)
If you have any metric you'd really like to monitor, please don't hesitate to request it! Maybe we can implement this for you :)
Sure there are tools for that. Try this: Android Systrace.

Is Titanium 1.8 finally free from the memory starvation issue from release 1.6 and 1.7

Hi there Im new to mobile application development. I had developed Android apps using Java and is just starting to get the hang of Cocoa Touch and Objective C. Now I am curious on mobile web application development to create cross platform/device applications which would at least run on Android and iOS(Apple devices: iphone, ipad). I tried Titanium and developing applications with this framework seems very promising. Although it is very powerful, popular, mature, documented and very easy to learn I had doubts investing time and to commit on using this framework for my projects after reading this blog which many Titanium users seems to agree with Why you should stay away from appcelerators titanium.
It seems that release v1.6 sdk and v1.7 sdk have the issue which they describe, the negative comments stopped right after the v1.8 sdk release was out.
My question is, is Titanium v1.8 sdk free from the memory starvation issue and other issues which were discussed on the blog post?
Would you personally recommend this for production use? And by the way I am using the 1.0.7.201112152014 Titanium build does this use the 1.8 sdk? Thanks in advance.
Take a close look at the progress of comments. It starts from people agreeing with him, and in the end everyone disagrees.
You can select the SDK you wish in the tiapp.xml editor, which is embedded in Titanium Studio. You should indeed use 1.8.x
The platform isn't, and probably never will be, memory issue free. But it also depends on how you build your app.
Stay away as much as you can from includes. And also stay away from creating a window/view/etc. with a file as url in it, this causes most memory issues because it's in a different space.
If you code well, you can use it perfectly without any issues.
Blog post author here. I don't fully agree with Topener - go ahead and read the comments yourself, it's just not true that "in the end everyone disagrees".
For what's worth: my experience is related to version 1.6.2. I've talked to people working with trunk and they told me that the memory issues are far from being resolved.
The only approach that seems to work is, as mentioned in the comments, the Tweetanium approach. But beware, that's not "if you code well". It's "if you code the way Titanium likes". If you take a look at Tweetanium (I suggest you to do it no matter what you decide to do in the end) you'll see that it has a very specific way to deal with architecture. If you follow that path, you should be good. If you think that the way Tweetanium is structured is good for you application, go for it. Be wary though, because (at least in what I consider to be complex) Tweetanium is not very complex, and with growing complexity I found that their approach is difficult to maintain. Again, evaluate for yourself.
Then there's the Android issue. Android support is far from optimal - Wunderlist decided to rewrite their Android version in native, I myself have had huge problems in making anything even remotely complex in iOS working decently on Android. If you need to support only iOS it's alright but, if that's the case, I don't see why you shouldn't write the app directly in Objective-C... considering also the (unavoidable) delay/mismatch between the Titanium and the iOS SDK.
Just my 2c. I suggest you not to take the decision lightly - it costed us a lot.

How to measure Phonegap UI performance?

I want to make performance improvements to my Phonegap application, currently targeting Android, but I want to base my actions on some measureable evidence.
Are there any tools I can use to measure the performance of Phonegap UI (time from clicking to finishing the action) on device? And mainly to measure the improvement of these times after I do some performance tuning?
Yes, you can use Traceview - it's an excellent tool:
http://developer.android.com/guide/developing/debugging/debugging-tracing.html
I'm currently using this
and i strongly recommend it
https://github.com/GameMaker/PhoneGap-Performance-Test--PGPT-
JavaScript is GC based language. It means, it has unpredictable GC time which makes main thread stops. This makes UI struggles. On native implementation, you have control to use GC or not.
This wouldn't be a problem on Android. Android always had those struggling because of GC on Java. Considering this fact, most of Android users doesn't care about UX a lot. But on iOS, your HTML5 based app never be better experience than competitor's native app.
There are many workarounds for this GC time issue. Such as incremental-GC, realtime-GC and so on. But actually, there's no real solution. Because the primitive problem is you don't have control.
Regards
Rajeev

Categories

Resources