Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

Jul 30, 2011

Why virtual machine for in-mobile applications ?


Why mobile phones, tablets, etc.. runs Java applications ? Okey, Java is good for web development, but why they are preferring Java for in-mobile applications ?
When we think about virtual machine what comes to our mind is Java or Java Virtual Machine. It has the advantage of 'compile once' and use it on any computer architecture without compilation, i.e platform independent. That is good from developer point of view, but what ever these Java guys claims, it is slower than any direct executable applications developed in C/C++.


Consider the case of Android running devices like Tablets, Mobiles. With the release of android each and every mobile manufacturers are now migrating to Android OS. A very good OS, I could say. But all applications on the android are running  on android on the top of Dalvik Virtual Machine (Just another virtual machine like JVM). 
This is a very good business model. Because any one can write application for android and that will run on any android based mobile devices independent of hardware. So the popularity of Android OS increases and that is what the OS vendors want. From the user point of view, he can install and run any applications on mobile, but it will be slow. This is the problem, the applications will be horribly slow.

Make applications fast is very simple. Say bye to this virtual machine methodology in in-mobile apps. Get the plain GNU/Linux as it is and port it into the tablet PC. It is not as easy as I said, I know :). But if H/W vendors collaborate with Linux to port it into Tablet PC, then open source applications can run directly on the top of Linux running in the mobile/Tablet. May be we would have to compile the source to install applications on the PC. May be it is cumbersome, but in the long run what matters is the speed. Wouldn't it be nice to be able to run applications in Tablets in Desktop speed.
There are cases in which java/virtual machine based systems are inevitable. For example: web applications, where platform independent codes has to co-exist together. A solution to this is an integrated system in PDAs where java and direct executable binaries  ( which developed in C ) work together.
With broad range of mobile phone vendors' count, I know that it is not going to be easy to make this possible but vendors like Apple or Blackberry can think of it as they have very limited number of hardware verities available.
When I browsed for this topic I came across a tablet PC developed by India. I think a collaboration with manufacturers like them can bring up research on this field and come out with applications runs directly on Linux based Tablet.

References:
Java Trap by Richard Stallman : http://www.gnu.org/philosophy/java-trap.html
India unveils Tablet PC : http://www.youtube.com/watch?v=lj4Cb3Jya2Q

Aug 2, 2010

android camera tutorial

To learn camera programming with android, what I did is downloaded some sample programs and opened that as existing projects in android. I am using ubuntu 10.04. The links that I used for camera tutorialis given below.
First download the existing projects. (better to hack an existing one than writing from scratch ;) )

Mar 22, 2010

android file handling

So start an emulator with sdcard some things that I tried ---->
  • emulator -sdcard sdcard1.iso -avd avd_1.5
  • mksdcard 8M sdcard
  • emulator -sdcard sdcard &
  • adb push YOUR_FILE_A /sdcard
list the files(directories also) on an SD card : http://markmail.org/message/qgfx35u7sjb4z4wr

Mar 21, 2010

setting Samsung Galaxy in Ubuntu 9.04


So here it goes…. the environment that I worked with is Ubuntu 9.04… Samsung Galaxy. It was not detecting in my ubuntu… so I fallowed these steps to detect it.. ( Thanks Saurav )….
Steps
Make a file 50-android.rules in /etc/udev/rules.d/ folder and add the following into that
SUBSYSTEM==”usb”, SYSFS{idVendor}==”18d1″, MODE=”0666″
———————————————————————————————
Make another file 90-android.rules in the same folder /etc/udev/rules.d/ and add this into that
SUBSYSTEMS==”usb”, ATTRS{idVendor}==”04e8″, ATTRS{idProduct}==”6640″, MODE=”0660″, OWNER=”root”, GROUP=”androiddev”, SYMLINK+=”android%n”
SUBSYSTEM==”usb”, SYSFS{idVendor}==”04e8″, MODE=”0666″

———————————————————————————————-
Now do this /etc/init.d/udev restart
———————————————————————————————-
Now connect the Galaxy phone into PC
Next go to android-sdk/tools/ then do the following
./adb kill-server
./adb start-server
./adb devices

If it is detected you r lucky…. otherwise you are more lucky, coz you r goin to learn more….
so,…. it should show something like the following
List of devices attached
I7500bH2irb7283 device

If your emulator is running it will show that also.
or if it is showing this…..
List of devices attached
then you have to change the adb with a patch version..
open a terminal
go to android-dk/tools/ folder then do the following….
wget http://floe.butterbrot.org/external/adb.gz
gunzip adb.gz
chmod +x adb

Now do this, ./adb devices.. I am sure it will show the device…. if it is connected… if not check following steps…
Note: here I have used Galaxy model I7500 its ID vendor and ID product is given 04e8 and 6640 respectively. That is why in the rules files I gave like this
ATTRS{idVendor}==”04e8″, ATTRS{idProduct}==”6640″
S if your are using a different model like Galexy I9000 or any other vendor product, you have to change these numbers accordingly. So for to get the number. Connect the mobile to the system and then open a terminal and type lsusb . Then you can see something like this

Bus 001 Device 003: ID 0fca:8004 Research In Motion, Ltd.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 002: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
ID vendor: product I have highlighted in green. First is my RIM blackberry. so find that two IDs and update that in rules files

Make a file 50-android.rules in /etc/udev/rules.d/ folder and add the following into that
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
---------------------------------------------------------------------------------------------
Make another file 90-android.rules in the same folder /etc/udev/rules.d/ and add this into that
SUBSYSTEMS=="usb", ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="6640", MODE="0660", OWNER="root", GROUP="androiddev", SYMLINK+="android%n"
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
----------------------------------------------------------------------------------------------

Actually I am working with number of mobiles, I have lot of rules files... so edit your rules files as shown in lsusb ... for u r mobile model surely that will be different..

Mar 16, 2010

Android-Content Providers...

Activities, Service, Content providers, Broadcast receivers the four heros of android... hu hu ha ha.. So this scratch is for the content providers.. simple defnition is 'provider of the content' or database...

Some points...
  1. Android applications can use a file or sqlite database to store data.
  2. CP provides a way in which we can share data b/w multiple applications
  3. Consider Contact DB.. If it is used by different apps,... put it in CP for to hv common access.
  4. if u want u r data to b public and accessed by many apps,.. put it in u r own content provider.
Apps can do following operations on CP
  1. Querying data
  2. Modify records
  3. Add records
  4. Delete Records
Standard CP are there : contacts, images.. implemented by android.

Querying data: We require content provider URI, URI consist of 3 parts..
  1. the string “content://”,
  2. segment representing kind of data to retrieve and
  3. optional ID of specific item of the specified content provider
URI : ( what is its full form ? )
  1. query URIs are somewhat arbitrary and confusing.
  2. For this android provide list of helper classes in android.provider package that define these query strings
this much is from : http://www.androidcompetencycenter.com/category/android-basics/

------------------------------------PART II-----------------------------------

So some scratches about Database ( before CP ) Okie ?.. Okie...
  1. Android uses Sqlite database system
  2. the database that you create for an application is only accessible to itself, others can't access it. is stored in the/data/data//databases folder
  3. Creating the 'DBAdapter' Helper Class; that creates, opens, closes, and uses a SQLite database. encapsulate all the complexities of accessing the database.
More about tat in this link: http://www.devx.com/wireless/Article/40842

Try with the Listings.. I m gonna try....

uph... a little difficult.. okie.. again bk to basics.... hureeee..... HLT

next Page: http://www.devx.com/wireless/Article/40842/0/page/2


reference
Cursor: http://developer.android.com/reference/android/database/Cursor.html
Context: http://developer.android.com/reference/android/content/Context.html

For Web Developer

  open -a "Google Chrome" --args --disable-web-security