Cook Your Wireless Application

Initiate developers towards Wirefree Solutions …

Tool for android Views and Layout.

“hierarchyviewer”

e.g. Usage

$ hierarchyviewer

A GUI tool will appear that will show devices on left hand side and running packages on right hand side. TO see how the View hierarchy looks like select Device first. then what package you are interested in and finally Load View Hierarchy  button. It might take 3- 5 seconds to appear.

Working with ADB shell.

ADB — (Android Debug Bridge)

As the name says, its a complete tool for ondevice debugging. It provides access to device data.

- let it be accessing different databases on device those are created by different applications. Imp for accessing data/data directory on Device your device has to be dev rooted.

e.g. for accessing databases on android, One need to go to data

From command line

> adb shell

you are in a android shell.

> cd data/data

>cd application.package.name

cd databases

then use sqlite3 utility for opening xxx.db

e.g. > sqlite3  xxx.db

SQLite version 3.5.9
Enter “.help” for instructions

If you want to see tables in the xxx.db
sqlite> .tables;

- A good source of adb command and its usage is

http://android-dls.com/wiki/index.php?title=ADB

How to Use MapActivity in Android

Getting Map View to work. A Three Step process …


1. use java “keytool” to generate Test Application RSA certificate.

Windows: Mac: Terminal
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -validity 10000

Now Generate MD5 Entry — with following Line …

$ keytool -list -keystore my-release-key.keystore

It will give result in this form
alias_name, Dec 14, 2009, keyEntry,
Certificate fingerprint (MD5): DC:00:83:C0:8A:A5:D4:DB:E9:CE:C6:25:6A:E2:70:EB

2. Now we need to put our key in following link

http://code.google.com/android/maps-api-signup.html

The key will be generated in this format on this webpage…
e.g. Your key is:    0ui8F2Ff_e83ArP9HG9JjCeLcRm6WzJu3z7rnGQ

The above generated key would be good for all apps signed with your certificate whose fingerprint is:

DC:00:83:C0:8A:A5:D4:DB:E9:CE:C6:25:6A:E2:70:EB

3. Add Following XML code in your AndroidManifest.xml 

<com.google.android.maps.MapView
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:apiKey=”0ui8F2Ff_e83ArP9HG9JjCeLcRm6WzJu3z7rnGQ”
/>

Using GPS features in your Android Application

Little Bit of Background to run GPS example in android device.

1. To add GPS Functionality in your Android application, you will have to add the ACCESS_FINE_LOCATION permission to the androidManifest.xml

e.g.

<?xml version=”1.0″ encoding=”utf-8″?>

<manifest xmlns:android=”http://schemas.android.com/apk/res/android” package=”net.learn2develop.GPS”> <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION” />

<application android:icon=”@drawable/icon” android:label=”@string/app_name”>

<activity android:name=”.GPS” android:label=”@string/app_name”>

<intent-filter>

<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />

</intent-filter>

</activity>

</application>

</manifest>

2. In Android, Loc based services are provided by the

LocationManager class in android.location package.

Your device can obtain periodic updates of the device’s geographical locations. Android application fires intent when it enters the proximity of a certain location.

3. Connect to android console to give commands to androids host (e.g. Emulator or device)…

tools>telnet

telnet> 0 localhost 5554

(this will connect to the currently active device….)

geo fix -77.230488 38.916336

[Read the rest of this entry…]

MIT Courses


MIT Open course ware  is the right place for getting knowledge online.

 

http://ocw.mit.edu/OcwWeb/web/home/home/index.htm

 

There are many courses from all streams that could be of our potential interest.

I have interest in computer science and Alternative energy resources. And I found my world here. .. so don’t take time just go ahead and look for your horizon.

 

 

Amit

Little bit about Android…

I want to say enjoy your android walk through with these android notes …

Know How / Android Platform .. 

Dalvik virtual machine

 Android use DVM (Dalvik Virtual Machine.) Following are some points  on DVM and android relation….

1. byte code vm similar to JVM
2. .dex byte code files -> java class files got converted into .dex files.
3. In Every process run in it’s own Dalvik VM runtime.
4. Mobstr cpus are register based so dalvik cuts over head
.dex allows proicesses to share system classes saves memory
5. Integrating and Extending the existing components …
Integrating existing components –>
Fire Intent and pick one of the already available set of library which we need for
example    –> Gmail wants photo and it integrate picasa lib for picking photos …
6. Android has flushed issue tracker
http://code.google.com/p/android
Group for discussion ….
http://code.google.com/groups.html
7. Bluetooth API –> Is part of the Android API..

  Introduction to SDK

  Concepts …. Application building blocks , There are Four building blocks of every android application. Every android application can have one of these or all of these in it.

1. Activity –> UI Components …
2. Intent Receivers –> Pices of code responds to notifications or status changes
3. Services –> dont have UI and runs in backgrounds ..
4. Content Provider –> Provide Handel to Deal with Data.

Some More Detail on these Building blocks

    1/ Activity –>
1/ Can be faceless
2/ can be in a floating window
3/ Can return a value.
4/ Can be embedded.

Views - Used for building android screens…

1. TextView EditText, Button, Image View
CheckBox, Lists
2. Every activity has a tree of views
1. view can be in xml
2. view can be instantiated from code.
3. support xml based styles and themes.

Layouts

1.  FrameLayout
2.    Linear layout
3.    RelativeLayout
4.    TableLayout
5.    AbsoluteLayout view given specific layout

   2/ Intents and Intents Filers

Intents description what you want to do.        
- Moving from one screen to another screen (we can declare intents what will do following task…)
- Caller calles startActivity(myintent),
- System picks Activity whose IntentFilter best matches myIntent.
- New Activity is informed of the Intent.
Intent Receivers
- Respond to alarms and notifications
- Will wake up your process if necessary
- System can broadcast intents : data


connections, phone state changes, etc.
- Intent receivers can start Services for lengthy tasks(e.g downloading new data).
- IntentReceivers in AndroiidManifest.xml
- Can also attach Intent Receivers to other objects so they can receive notifications( Activities , Views etc.)

 3/ Services

- Faceless classes that run in the background.
- Music player , network download, etc.
- Services run in your applications process or their own process.
- your code can bind to Services in your process or another process.
- Once bound, you communicates with Services using a remotable interface defined in IDL.

 4/ Content Providers

- enabling data sharing across Applications .
- Query data (Returns Cursor)
- delete , Update , and insert rows.
- Hide underlaying implementation
- Work across processes.
- All content is rep by URI’s
- Convenience methods mean clients dont’ need to know syntax

 Application Life Cycle …

        - Applications run in their own processes.
- Processes are started and stopped as needed to run an app components Process.

         Life cycle Methods …   
onCreate() –> we can check revive all the states when we get back to here ….
onPause()  –> we would like to pause and save all of our states ….
onStop()    –> we like to close services or other system resources that we have acquired.

-  There is a limit for amt of computations in onCreate() or lifeCycle Methods So be careful while using them and decide  what to put what not to put …..

 

 Other API’s in Android

1. 2D Graphics ….
We can build custon graphics components ….

2. Location Manager
-    Applicationa can refister for notifications of current locations
-  Can register for app specific Intents to be fired based on proximity.
- We can register with location manager for particular loc so that we can get to know the location
- Track files …  lugia@mit.edu (Anh Nguyen) xml file containing lat long, or google earth file …
- Map view , MapActivity,

3. Media Support …
- Play back and record media files
- Audio , Pictures and video
- Codec’s still being decided (mp4, wma etc ….)

- Access through intents
Stream from a URL
Set MIME type to help decide action

- Also class level API
Embed playback
Recording.
- Streaming through RTP

4. XMPP Service –> we can use GTalk service ….
logged-in to Gtalk -> we can send messages to friends …

5. Application management services …

6. LowLevel H/W API’s
- API’s not yet available.
- Accessing Bluetooth.
- Accessing Wifi.

 

Microsoft Visiual studio plugin for Blackberry.

The BlackBerry® Plug-in for Microsoft® Visual Studio® allows Microsoft® based developer to develop wirelessly enable applications for BlackBerry® smartphones. Download the Plug-in.

Key benefits for developers include:

  • Familiar development experience — Plugs into an existing Microsoft Visual Studio 2005 development environment, providing a familiar experience for .NET developers to create rich client applications for the BlackBerry platform.
  • Seamless wireless connectivity — Leverages the inherent security and managed wireless connectivity of the BlackBerry® Enterprise Solution, allowing developers to seamlessly connect to back-end enterprise systems using .NET Web Services.
  • Simplified BlackBerry development — Provides a framework of re-useable BlackBerry application components that simplifies user interface design, data management and wireless connectivity of rich-client applications.
  • Enterprise-class security and manageability — Applications developed using the BlackBerry Plug-in for Microsoft Visual Studio will leverage the same secure, push-based technology and scalable architecture of BlackBerry® Enterprise Server. IT departments also benefit from simplified management and centralized control of their wireless deployments.

For downloading the plug-in developer needs to have plackberry developer community UID and password. For registration onto blackberry Developer community click.

Dowload the blackberry knowledge base. Click

–Amit
 

File Handling in J2me.

_________________________________________________________________________

||–|| File Handling Example ||–||

This example explains how we can use File handling API JSR 75 on J2me Handheld.I have used SonyEricsson Handset to test the Code. The following code does very simple job, It save the image in the File system of the phone. _________________________________________________________________________

Please click on more to see code ….

[Read the rest of this entry…]

LWL (Light weight logger)

LWL (Light weight logger).

Release Features 

1.       Logger has very less number of classes.

2.       Easily configurable Logging levels.

3.       J2ME LWL view can easily differentiate logs on the bases of Logging levels.

4.       J2me LWL can ignore logs on the bases of logging levels.

5.       J2me LWL can be easily switched off or switched on.

Logging API

Logging Levels Interface

Logging levels is nothing but a log differentiating parameters.

*     INFO       : General Information kind of log.

*     SEVERE     : ERROR or Exception LOG.

*      WARNING   : WARNINGS App Developer can use only when there is a problem which can

                     e.g. for using levels LoggerLevels.INFO 

Logging Class

1.       Static Method for setting J2ME LWL configuration , this method can  be called anytime before calling logging function, configureLog method has four parameters as follows,

LOG_INFO_BOOL_PARAM à   Boolean parameter for configuring informative logs.

 LOG_SEVERE_PARAM à Boolean parameter for configuring SEVERE kind of problems for e.g. Exceptions and ERRORS.

LOG_WARNING_PARAMà Boolean parameter for configuring a warning kind of logs.

NO_OF_LOG_ENTRIES à For configuring upper limit of log.

LOGGING_ON_SYS_OUT à for logging on system output. public static void configureLog(boolean LOG_INFO_BOOL_PARAM ,boolean  LOG_SEVERE_PARAM ,boolean LOG_WARNING_PARAM, int NO_OF_LOG_ENTRIES)

                e.g. of calling the method

                LogUtil.configureLog(true,true,true,10);

2.       j2me LWL Method for logging, This method has three parameters they are as follows,

a.       logEntry à String value of Log.

b.      logType à Logging level accepts integer constants values given in LoggerLevels interface. e.g. LoggerLevels.INFO

c.       clear à for keeping one log at a time.

public static void log (String logentry, int logType, boolean clear); e.g.        LogUtil.log(“FirstLogEntry”,LoggerLevel.INFO,false);3.       J2me LWL method for closing the record store the data base of LWL. This method has no parameters. This should be called for closing the database.Public static void freeLoggerUtils ();LogUtil.freeLoggerUtils(); 

Log Viewing Utility

This utility can be used for viewing logs , to use the logging utility application has to do following tasks, The tasks are as follows.

1.       While building an application integrate J2meLWL.jar in lib directory.

2.       Once application is build put an entry in .jad file of application i.e.

a.       Midlet-n: Logger,, com.Logger.ViewLog

________________________________________________________________________________

Please Click on More to View Code …

[Read the rest of this entry…]

SCMAD By:- Terence Doyle

J2me Sun Certified Mobile Application developer exam Notes, By:- Terence Doyle