My app runs slower on Android 4 than Android 2 - android

I've got an app out for Android that generates sound.
When the CPU is over worked, it doesn't run a tight enough loop and the result is snaps, crackles, and pops in the audio.
I was thinking that with newer devices, there would be less of this.
But it looks like on the tablets and newest phones, where I would expect better hardware and smoother audio, it usually seems to be worse than my old old Droid and Android 2.2.3.
I've got some more testing to do (I usually test this stuff in a Verizon or AT&T store as I can't afford all that hardware myself), but this seems to be the case so far.
What I'm wondering is there anything specific from Android 2 to Android 4 that could account for this?
For example a "governor" that limits how fast a Thread can run.
The loop is running in the run() of a subclass of Thread. It's created in an Activity (as opposed to a Service).
I would post the name and a link to the app (it's free) but I'm afraid that would probably be viewed as spam, or at least improper etiquette.

Related

Android build for limited function device

I'm trying to build a limited-functionality Android system for our device, which needs to boot quickly, but everything we do seems to slow it down.
For example, our device has no camera, no bluetooth, no wifi, but turning them off wholesale in various /system/etc/init/*.rc files seems to actually slow it down, due to the interdependencies of Android. The services that are turned off end up restarting, or causing timeouts in Settings, for example.
(Android is on the device for its' UI, not for its connectivity abilities.)
Do you have any suggestions for how to do this? Surely Android for cars, TVs and tablets have had to deal with these issues before.
You did not specify what you did exactly, but if you tried to not start HAL services on startup they might just be started dynamically later. If you are using Android 8 or newer you could merge multiple HALs in one process. But I doubt that this will give you any significant speed-up.
Android does provide a guide on how to optimize boot times: https://source.android.com/devices/tech/perf/boot-times. However, you will notice that they focus on the bootloader, kernel, file system, SELinux, and parallelizing init. The elephant in the room is Zygote. It takes forever to start because it preloads the whole Android SDK.
From its history, Android did not care too much about startup times, because you typically do not restart Android. Instead, they rely on Suspend-to-RAM.
You should think about what you want to have your user experience early. Example: for Automotive Android, Google needs to support a rear-view camera that is available within two seconds after boot. They achieve that by a second, faster stack that provides first images before the application SDK is started and takes over. See https://source.android.com/devices/automotive/camera-hal

Android application lag in different phone but same processor

I built an android application and am I now in the testing phase. I tested my application on the following 2 devices:
Sony Xperia Z3
One Plus One
Both devices have the same processor and ram, but the performance on Sony Z3 is laggy whereas on OnePlus One it is smooth. I looked up about this on google but I couldn't find an answer.
Is there a reason for this behaviour?
The reason why Android applications lag on the devices may have various background. If the UX of your app suffers from lagging it's worth learning tools that Android Studio comes with. This is my suspicion based on your description but I suggest focusing in particular on Method Profiler as it will immediately indicate the causes of lags. Mostly probably there are some heavy calculations executed or massive objects creation performed on the UI thread.
Alternatively, the following libraries will help you with detecting sensitive places that the application's performance may suffer from:
https://github.com/brianPlummer/TinyDancer
https://github.com/square/leakcanary
Pretty good working example below:
https://github.com/artem-zinnatullin/qualitymatters

Getting Started in Android Development on Nook

I am an experienced Apple developer who is looking to develop for Android. I do not currently own any Android devices, so I am considering purchasing a B&N Nook HD for development purposes, which now runs Android. From the research I've done, it seems that the spectrum of Android devices is quite varied and disorganized compared to the Apple world (no offense intended). So, my question is, even though there are better (more expensive, too) devices to purchase (Nexus tablets), will a Nook HD suffice for beginning Android development? By the way, my intentions are to develop mostly tablet utilities with emphasis on networking and data manipulation. I'm not really interested in hardware-specific areas like graphics and sensory input (with the exception of the touchscreen, of course). Thank you for your advice.
In a general sense, yes. Your device will do just fine. However, a caveat is that you must take into consideration the flavor of android you are planning to target. e.g. Working on a Froyo flavor won't necessary guarantee it will run on the latest Jellybean and so on.
Hell, I started developing android almost 2 years ago (but stopped indefinitely) but it was only this year that I took it upon myself to get a PHYSICAL android device when I continued to develop my app. For no particular reason I just dropped by the local gadget mall and randomly picked the Samsung Tab 3. Yes, reviews are bad and it kernel panics a lot but these are trivial things for my specific use.
The one major problem I had? Dealing with REAL input from REAL data on a REAL device. My app worked sufficiently fine on the emulator. When it ran on the Tab it was breaking everywhere!

Can I handle Android fragmentation all by myself for my VOIP app?

I built a very VOIP app for android phones. All i have is a text field that lets a user enter the username of the person they'd like to call. Then when they press call, it will wake up the recipients phone and play a ring tone. The recipient can answer or decline the call.
At the moment the app "almost" works fine on the following devices:
Galaxy Note 1 with OS 4.0.4
GS3 with OS 4.2.2 and 4.3
GS2 with OS 4.0.4
Nexus 4 with OS 4.2.2
Some minor issues I'm having are calls between some GS2 phones (GT-S7530M) to some GS3 phones, where the audio is extremely quiet. I'm not sure why this is, even though we maxed out the volume. Other times, there's plenty of crackling in the calls, or you miss out on people's sentences. We made sure the network speed was always at least 15mbps download and 1.5mbps upload.
Every other phone seems to work fine.
I am using linphone as the sip library for the phone. I am using asterisk as the telephone server. I am using GSM as the codec for the phone and for the asterisk server. I'm pretty sure I'm not doing anything "special" with my code. It's a simple app and I think any experienced Android developer will find my code pretty minimal and simple.
My question is, assuming I correct the issues for the targeted phones above, is it realistic for a single programmer to attempt to make this voip app work on 70% of modern android phones that are running OS 4.x+? Let's assume I want to be able to hit 70% target within a few weeks.
Some of you might think my question is too broad, so I want to make it clear that i'm just looking for a yes or no answer to whether it's realistic or not and the reason for your answer.
The reason I'm asking is because I had an earlier prototype, and I asked some strangers with other phones like Sony Xperia ZL, HTC One etc... and they seemed to have problems getting my app to work correctly. They experienced problems like the ring tone didn't work, or they couldn't receive a call (even though they successfully connected to my asterisk server), or the audio quality was extremely poor. This led me to do a bit more research on the popular problem known as Android Fragmentation. When I saw all the android phones out there, it scared me. Can I really reach 70% of modern android phones running OS 4.x all by myself in the next two weeks? Will this new version that I've created with bug fixes for Note 1, S3, S2 and Nexus 4 work perfectly on the other phones?
It's a very simple app
I long for the day when we can actually describe a custom VOIP app as being simple. It's 2013, and we cannot say that today with any degree of accuracy. IMHO, your app is rather complicated. It just so happens that most of the complicated bits are in a glob of open source code that you did not write (linphone) and a third-party server that you did not write (Asterisk).
It's a simple app and I think any experienced Android developer would find my code pretty minimal and simple
Pretty much all of the symptoms that you have described would either be part of linphone or part of Asterisk, from what I can tell. Your code may be simple, but your app is not.
is it realistic for a single programmer to attempt to make this voip app work on 70% of modern android phones that are running OS 4.x+?
If you remove linphone and Asterisk from the equation -- say, by rewriting your app to play a ringtone based upon an GCM user notification -- your objective seems reasonable.
However, since your app as presently constituted is almost completely linphone and Asterisk ("any experienced Android developer would find my code pretty minimal and simple"), your success is gated by how well linphone works on Android, and how well linphone-on-Android works when communicating with Asterisk.
Hence, the only people who will be able to answer that are those experienced with those technologies. You might try asking on some dedicated linphone and/or Asterisk resources. Or, you might ask fresh StackOverflow questions, with tags appropriate for those technologies, with more focus.
No. Some carriers inflict inanity: sip hostility or not awesome flavors of IPv4 to IPv6.
Currently I am also working on an Android VoIP client.
Actually there is no any difference between the different hardware and OS versions except this audio handling headache.
Unfortunately there are a lot of inconsistencies in the audio implementation by the different vendors. I would suggest you to have a look at some open source SIP softphone source code such as sipdroid, mizudroid and csipsimple. I was learnt a lot especially from sipdroid, although the code is not well commented. Be prepared to a lot of workaround handling each devices differently.

Android Emulator or Android Phone

I hope you're all good. I am working on an android application project and I mostly use android emulator for testing the application. Android Emulator takes too much time for application loading and since I am working on the design I have to run the application after a few seconds again and again. Because of slow emulator I think my time is wasted and I can't focus on the work.
I recently tried my Galaxy Note for running application and its quite fast and running experience is much better. What I wanted to know is.. Does running eclipse project on my Phone will harm my mobile phone in any way?
Because moments back while using the phone the screen got stuck and the icons changed to different green, red and blue color. I restarted the phone and its acting normal now. But I wanted to know if it happened because of the eclipse project running on the phone? Is it safe ?
It is possible to harm your phone.
Apart from the wear and tear (YMMV) of repeatedly flashing your app to memory you may unwittingly (or otherwise) create a virus.
I've been in a situation where a thread has run amok after the app terminated and hogged the processor slowing things down. It did eventually quit though (possibly after elective rebooting). I've often had my phone restart when debugging on it. I wouldn't worry too much about that (although my domain was Samsung's bada, a lot less robust platform).
I don't see too many risks with Java apps as the language is so well managed. Native code is a risk in that, at least, a buffer overflow could place unwanted code outside of the process address space and so escape being cleaned up when the app quits. A shut down and/or force close may result from such errors.

Categories

Resources