Sunday, June 30, 2013

Google maps using API version 2

I started developing an app which requires Google maps.
To use google maps in an android app, we need to take care of following things.

1) Google play services : this can be downloaded from SDK manager in Extras category.

2) support jar

3) We need to generate API key. There are two types of Keys available. One is debug key and second is release key. Whenever we deploy an app using Eclipse, by default we use debug key.
There are a lot of tutorials available to generate API key. Without it Google maps wont load.
4) Check access permissions in androidmanifest file.

Note : Don't use ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION in one go.
Use ACCESS_FINE_LOCATION instead.

Above note use useful if you are facing issue getting current location. If location object is null then above note is very helpful.

5) Google maps will work on physical device only. We wont be able to test our app on emulator.

Have a happy coding!

Tuesday, June 25, 2013

Android Basics

1) Activity - Whenever we start any application in android, first call will be to activity.
For example, we have started facebook application. Login page will get open first that is the Login activity which will get called first. Once logged in News Feed activity will get called.
Wall, login screen, etc.

2) Intents - Whenever we want to access some data/activity within the activity then intent comes into picture. To call other activity from the existing one intents are used. Those are acts as mediator.

3) Services - Services are nothing but background jobs which are running in background.
Ex. Music, Network download, etc.

4) Broad Cast receiver - These are silent observers. Whenever app asks them to provide some info after the event occurs they will carried out the same. Ex. battery low indicator

5) Content Providers : Address sharing, Photo Gallery etc.


Lifecycle of android apps :

1) Starting state : before apps get running it will be in Starting state

2) Running state : once apps come in foreground it will be in running state and user is interacting with it.

3) Paused state : when apps is in foreground state but user is not interacting with it then it is in paused state.

4) Stopped State : when user is not interacting with it and it is in background then it is in stopped state.

5)Destroyed state : when application is no more available for use i.e. it is not in stopped state.