Life ray Android example
Hi I am doing Android example using life ray. Here I did
sample application in android that is I am populating the life ray countries
table data in Android by using web services.
The following are
the steps to the Android Application.
Prerequisites
We should have minimum development knowledge in Android application development.
Step: 1
The following tutorial will give good understanding about Android Application Development
Step: 2
Get the Android Development Tool
from Following URL.
Note: This downloaded rar file having eclipse and Android SDK
and Its tools like Android Emulator.
Step: 3
Extract this rar file in your local system. You can find
folders name like adt-bundle-windows-x86
(for windows). If we open the adt-bundle-windows-x86 you can find two folder
eclipse and sdk.
The following screen depicts what is available in rar file.
You can find two folders
Step: 4
Go to eclipse folder and launch eclipse by clicking on
eclipse.exe icon.
Now eclipse will be launched and it will ask you work space
and select your local work space.
In the below screen you can see the Android icons in
eclipse.
Step: 6
Go through following link this tutorial explain how to run
basic example in Android.
Now we have experience with Android Application Development.
Liferay Android Application
This Life ray Android Application populating Liferay country
table countries in Android Mobile.
The concept behind this application is by using life ray JSON web services I am
populating data in android in grid view by using Android components.
Here we have good experience with calling life ray web services
in liferay. The following links are give you good knowledge about how to create
liferay json web services and how to consume json web services.
Once you read the tutorial then you will get good experience
on calling life ray json web service from other client.
Now you can get Android
Liferay Example from following location.
Once download Android Application .Place application into
your android work space and Import this project into your eclipse as Android
Existing Application.
Note: While import you may get some errors so that from the downloaded
app you can delete .project, .classpath and proguard.cfg files from your
downloaded example before import.
Once download Android Application .Place application into
your android the following are the screens which depicts how to import Existed
Android Project into eclipse.
Screen-1
Screen 2
Screen 3
Run Android Application from eclipse.
Once run the
project you can observe the following information in console like this.
Once application successfully installed then you can find
Android emulator there you can see the emulator screen with countries data.
Important Points:
In the example to get JSON I am using apache http client mechanism.
In that I used URL to connect client and get the data from
liferay. In main.java class you can
find following line.
JSONArray countriesJsonArray=JSONfunctions.getJSONfromURL("http://www.yourdomainname.com/tunnel-web/json/?serviceClassName=com.liferay.portal.service.CountryServiceUtil&serviceMethodName=getCountries&serviceParameters=[]");
|
Note:
When use localhost to app that is not working. So your
application in network host with domain name (I am not sure but for me it’s not
working for localhost ).
When I used liferay portal which Is in network with www.xxxx.com then the data is getting in mobile.
Solution For Above Problem:
Use IP address of your system in the code instead of localhost
Example: 127.0.0.1 or your LAN IP like 10.0.0.25
You can get More Information about why localhost is not worked? see below link
http://www.liferay.com/community/forums/-/message_boards/message/18228590
Output in Emulator
Solution For Above Problem:
Use IP address of your system in the code instead of localhost
Example: 127.0.0.1 or your LAN IP like 10.0.0.25
You can get More Information about why localhost is not worked? see below link
http://www.liferay.com/community/forums/-/message_boards/message/18228590
Output in Emulator