Posts

Showing posts from December, 2013

Call SOAP web service in Android

Image
Web Services: By using web services, we can transfer data between the electronic devices. If we create web services for one platform and it can be accessible from any of the platform. There are many types of web services. Some of them are, ·                      JSON ·                      SOAP Soap Web Service:             Simple Object Access Protocol (SOAP) is a standard protocol specification for message exchange based on XML. Communication between the web service and client happens using XML messages. Steps To  Invoke Soap Web Service             1.Download ksoap2-android-assembly-2.5.2-jar-with-dependencies.jar and paste into libs folder.             2. You can download ksoap2-android-assembly-2.5.2-jar-with dependencies.jar here . 3. Create Android project with name as "MobileAppSecurityCode". Set Main Activity name as "GenerateCodeActivity". This is the code for GenerateCodeActivity. package com.etr.securitycode;

Import Existing Android Project in Eclipse

Image
Importing an existing android project in eclipse is very easy.As importing project is very easy,We can modify our existing android project as our wish. These are the following steps to import our android project.   1 .  Select   File > Import  > Select Existing Android Code Into Workspace and click Next.     2. Now we can see the Import Projects Screen.   3. Click Browse Button and select your existing android project and then click OK.                           4.Select the copy project into workspace check box in import projects screen and then click Finish .

Android Audio Recorder

Image
The Android multimedia framework includes support for recording and encoding a variety of common audio formats, so that you can easily integrate audio into your applications. MediaRecorder is used to record the audio MediaPlayer is used to play the recorded audio The Android Emulator does not have the ability to record audio, but actual devices are likely to provide these capabilities. Create a new instance of android.media.MediaRecorder. Set the audio source using MediaRecorder.setAudioSource(). You will probably want to use      MediaRecorder.AudioSource.MIC. Set output file format through MediaRecorder.setOutputFormat(). Set output file name through MediaRecorder.setOutputFile(). Set the audio encoder through MediaRecorder.setAudioEncoder(). Call MediaRecorder.prepare() on the MediaRecorder instance. To start audio record, call MediaRecorder.start(). To stop audio record, call MediaRecorder.stop(). When you are done with the MediaRecorder instance, call MediaRecord

Android Detect Internet Connection Status

Image
When we use internet connection for our operation,first we need to check internet connection availability.For example : Invoke web services,network operation,etc. You can download source code here. This is code for GenerateCodeActivity. It will invoke SOAP response from our server. package com.etr.securitycode; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; public class GenerateCodeActivity extends Activity { private String METH