Android Hardware Acceleration – to use or not to use?

To use or not to use It is advised to use hardware acceleration only if you have complex custom computations for scaling, rotating and translating of images, but do not use it for drawing lines or curves (and other trivial operations) (source). If you plan on having common transitions and also given that you have … Read more

Android Install on Device Failure [INSTALL_CANCELED_BY_USER]

Happens to my Xiaomi phone after updated it to MIUI 8. Took me hours to figure it out! Check the followings if you’re a victim too: Go to Settings -> Permissions -> Install via USB: Uncheck your App if it’s listed. Go to Settings -> Additional Settings -> Privacy: Check the Unknown Sources option. Finally … Read more

Android: Get Hardware Information Programmatically

Log.i(“TAG”, “SERIAL: ” + Build.SERIAL); Log.i(“TAG”,”MODEL: ” + Build.MODEL); Log.i(“TAG”,”ID: ” + Build.ID); Log.i(“TAG”,”Manufacture: ” + Build.MANUFACTURER); Log.i(“TAG”,”brand: ” + Build.BRAND); Log.i(“TAG”,”type: ” + Build.TYPE); Log.i(“TAG”,”user: ” + Build.USER); Log.i(“TAG”,”BASE: ” + Build.VERSION_CODES.BASE); Log.i(“TAG”,”INCREMENTAL ” + Build.VERSION.INCREMENTAL); Log.i(“TAG”,”SDK ” + Build.VERSION.SDK); Log.i(“TAG”,”BOARD: ” + Build.BOARD); Log.i(“TAG”,”BRAND ” + Build.BRAND); Log.i(“TAG”,”HOST ” + Build.HOST); Log.i(“TAG”,”FINGERPRINT: “+Build.FINGERPRINT); … Read more

Android AudioRecord class – process live mic audio quickly, set up callback function

After experimenting lots with the notifications and a bunch of other techniques I settled on this code: private class AudioIn extends Thread { private boolean stopped = false; private AudioIn() { start(); } @Override public void run() { android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO); AudioRecord recorder = null; short[][] buffers = new short[256][160]; int ix = 0; try { // … Read more

Android camera android.hardware.Camera deprecated

API Documentation According to the Android developers guide for android.hardware.Camera, they state: We recommend using the new android.hardware.camera2 API for new applications. On the information page about android.hardware.camera2, (linked above), it is stated: The android.hardware.camera2 package provides an interface to individual camera devices connected to an Android device. It replaces the deprecated Camera class. The … Read more

Get Android Phone Model programmatically , How to get Device name and model programmatically in android?

I use the following code to get the full device name. It gets model and manufacturer strings and concatenates them unless model string already contains manufacturer name (on some phones it does): public String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.toLowerCase().startsWith(manufacturer.toLowerCase())) { return capitalize(model); } else { return capitalize(manufacturer) + … Read more