Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Thursday, June 25, 2015

Hybrid Application Frameworks for faster app development

It's been longggg time since i have posted anything on this (To be precise, it is 2+ years)
I have been moved from writing device drivers to the Hybrid application development - for Android and IOS devices.

First hybrid application platform which i have worked on is Phonegap.

Now, I am working with Xamarin (An Awesome platform for .NET geeks) and will post my learning/Adventures with Xamarin very soon.

Xamarin Guide link

Thursday, May 02, 2013

How to resolve the USB-Ethernet device un-registration on Android.



         On Our OMAP4 board, we were enabling the USB-Ethernet functionality. We were using the SMSC Ethernet drivers. The 'eth0' interface was getting registered succesfully , but immediately the interface was getting removed off.

  Root Cause : It seems like , android intentionally removing the Ultra Fast Medias from the system.
  In one of the init.rc file, this below piece of code was creating the havoc.

# Remove the Ultra Fast Media Card Reader on EHCI bus
# write /sys/bus/usb/devices/1-1.1/remove 1

Thursday, May 10, 2012

Multi-Touch (Pinch-zoom) support to Android Applications

In this post, i am going to explain the mechanism to enable the multi-touch support for Android applications.

Introducing multi-touch
Multi-touch is simply an extension of the regular touch-screen user interface, using two or more fingers instead of one. We’ve used single-finger gestures before, although we didn’t call it that.
Three common touch gestures .
a) Tap
b) Drag
c) Pinch-Zoom
With pinch zoom, you place two fingers on the screen and squeeze them together to make the item you’re viewing smaller, or pull them apart to make it bigger. Before Android 2.0 you had to use a clunky zoom control with icons that you pressed to zoom in and out . But thanks to its new multi-touch support, you can now pinch to zoom on Android too! As long as the application supports it, of course.
Enable the multi-touch for Android Applications
By default, all the android applications won't be enabled for the multi-touch functionality. You need to explicitly mention this feature in your AndroidManifest.xml file of the application. 
The applications like 'Browser', 'Maps' and 'Gallery' will usually require this feature.
 a) Include the below lines in your application manifest file
      <uses-feature android:name="android.hardware.touchscreen.multitouch"
                  android:required="true" />
b) Copy the respective multitouch.xml file onto /system/etc/permissions folder. This is an important step when we know that from the hardware side the multi touch is already supported. 
       Include the below lines in your device.mk file.
     PRODUCT_COPY_FILES := \  frameworks/base/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
Refer PackageManager.java for more info . (frameworks/base/core/java/android/content/pm)

References

Monday, January 16, 2012

Log Function for Debugging Native Code in Android

Follow these steps to enable logs in the native code.

1) Include the "log.h" in the native code . Preferably in the beginning of the file.

     
          #include "android/log.h"       

2) Write the "my_log" function in the source file


void my_log(int level, const char *format,...)
{
    va_list arglist;

   va_start(arglist, format);
     __android_log_vprint(level, "file_name.cpp", format, arglist);
   va_end(arglist);

   return;
}

3) call "my_log()" from your function.
 
ex:
   int my_function()
   {
       .........
       .........
       my_log(ANDROID_LOG_DEBUG,(const char *)"my_function has been called") ;
       .........
       .........
   }


Note :
a) "android/log.h" doesn't define LOGE, LOGD, etc.. but only a few functions
like __android_log_print() that you are free to wrap around your own
logging/debugging macros. 


b) LOGD/LOGE are used internally by the Android sources (in <cutils/log.h>),
but are not exposed by the native code for fear of conflict with other logging
systems.

Thursday, December 22, 2011

How to add Indian Languages to Android ICS (4.0.3)

Google is officially supporting the Indian languages rendering from 4.0.3 onwards.
The AOSP code supports rendering of three Indian languages in Web-kit. (Devanagari, Tamil, and Bengali).
I just added support for the other Indian languages as well. Tested it on my Nexus-S device

Prerequisites :

Follow these instructions:

1) Download the "Binary" file of the Indian language from this link.
         Ex: lohit-kananda-ttf-2.5.0.tar.gz

2) Untar the downloaded file and Copy the extracted folder into  
    external/lohit-fonts directory
        Ex: lohit-kannada-ttf-2.5.0

3) Rename the folder name to lohit-kannada-ttf

4) Modify the Android.mk file which is present in external\lohit-fonts directory

       ifneq ($(SMALLER_FONT_FOOTPRINT),true)
            extra_lohit_fonts := Lohit-Bengali.ttf Lohit-Tamil.ttf Lohit-Kannada.ttf
        endif 


       include $(CLEAR_VARS)
        LOCAL_MODULE := Lohit-Kannada.ttf
        LOCAL_SRC_FILES := lohit-kannada-ttf/$(LOCAL_MODULE)
        LOCAL_MODULE_CLASS := ETC
        LOCAL_MODULE_TAGS := optional
        LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts
        include $(BUILD_PREBUILT)

5) Modify the FontAndroid.cpp file (external/webkit/source/webcore/platform/graphics/android)

    a) Add an language entry to CustomScript enum
             enum CustomScript {
               Bengali,
               Devanagari,

               Kannada,
               .......
              };

    b) Add the ttf file path to the TextRunWalker Paths

           const char* TextRunWalker::paths[] = {
              "/system/fonts/Lohit-Bengali.ttf",
             "/system/fonts/Lohit-Devanagari.ttf",

             "/system/fonts/Lohit-Kannada.ttf",
             ........
          };

    c) Now setup the Font for Script Run
         TextRunWalker::setupFontForScriptRun()
          {
            case HB_Script_Kannada:
              complexPlatformData = setupComplexFont(Kannada, platformData);
            break;

          }
 
6) Add the *.ttf file in Fallback_fonts.xml (frameworks\base\data\fonts)

Note : Assamese language is not enabled as Harfbuzz is not supporting this language.