Mobile application development is a set of processes and procedures involved in writing application software for small, handheld or wireless computing devices such as smart phones, PDAs, EDAs or tablets.
In Mobile App development process, Mobile User Interface (UI) Design is also an essential part considering constraints & contexts, screen, input and mobility as outlines for design.
One critical difference between Mobile application development and traditional software development, is that mobile applications (apps) are often written specifically to take advantage of the unique features a particular mobile device offers. So, the development should be centric on optimum performance for a given device, even when application is interacting with external applications.
In such a scenario (interaction with external world) REST API is the best option. REST stands for Representational State Transfer & it is a simple stateless architecture and a communication approach that generally runs over HTTP.
REST is preferred over SOAP (Simple Object Access Protocol) for development of web services as the latter is quite heavyweight and consumes comparatively greater bandwidth. Owing to its decoupled architecture and lighter weight communications, REST usage is very prevalent in mobile applications. It is a better fit for use over the Internet and easily binds with cloud-based APIs like those of Amazon, Microsoft, and Google.
Here is an example to ” Create REST API client Async in android ”
1. This is AsyncTask which will run in background with affecting the UI.
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import android.os.AsyncTask;
public class CallRestApi extends AsyncTask
{
public AsyncResponse delegate=null;
public CallRestApi(AsyncResponse asyncResponse) {
delegate = asyncResponse;//Assigning call back interfacethrough constructor
}
@Override
protected void onPreExecute() {
// if you want, start progress dialog here
}
@Override
protected String doInBackground(String… params)
{
String urlString = params[0];
String resultToDisplay = “”;
InputStream in = null;
try
{
URL url = new URL(urlString);
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
in = new BufferedInputStream(urlConnection.getInputStream());
resultToDisplay = convertStreamToString(in);
in.close();
} catch (Exception e)
{
System.out.println(e.getMessage());
return e.getMessage();
}
return resultToDisplay;
}
@Override
protected void onPostExecute(String result) {
// if you started progress dialog dismiss it here
delegate.processFinish(result);
}
private static String convertStreamToString(InputStream is)
{
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try
{
while ((line = reader.readLine()) != null)
{
sb.append(line + “\n”);
}
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
try
{
is.close();
}
catch (IOException e)
{
e.printStackTrace();
}
}
return sb.toString();
}
}
2. Create Interface for getting result.
This is for getting AsyncResponse in the activity class
public interface AsyncResponse {
void processFinish(Object output);
}
3. Call REST API client from activity class
private void functionName(String newUrl)
{
CallRestApi client = new CallRestApi(new AsyncResponse()
{
@Override
public void processFinish(Object output) {
String responseResult = ((String) output);
});
}
try
{
client.execute(new String[] { newUrl });
}
catch (Exception e)
{
e.printStackTrace();
}
}
Enjoy 🙂
Avinash
That is all for this article, in case you need Salesforce Implementation Services for any Salesforce related work, then please feel free to reach out to sales@girikon.com
Connectivity is the key in the modern world. Everyone is looking at 24*7 connectivity to achieve the highest levels in sales, marketing and services.
The Salesforce1 Customer Platform has a bouquet of new APIs, mobile tools and more to enable you to connect to all your devices and to all your customer data. It empowers and prepares you for this new word where hyper-connectivity is setting new standards of expectations among customers. The platform readies you for very personalized customer service with real-time insights into customer problems and needs.
With Salesforce1 you can get the following features :
All your sales, service, and marketing data at your finger tip
Instantly bring your customizations like workflow, permissions, and sharing settings to mobile.
All your custom objects, fields, and any app you’ve integrated or built declaratively is now mobile.
The apps you’ve downloaded from the AppExchange are now accessible from anywhere.
Global and contextual actions you’ve created for the publisher.
View all the posts and processes that need your attention in the notifications center.
Connect with other employees and collaborate on sales opportunities, service cases, campaigns, and projects.
Access everything you need from your favorite device, iOS, or Android.
With complete and open APIs, developers can build the next generation of apps today. Mobile-ready and more accessible, it’s the fastest way to connect anything to everything. And sell, service, and market on any device. Everywhere.
That’s all folks for today. That’s all for this article, in case you need Certified Salesforce Consultant then please feel free to reach out to us at sales@girikon.com
Salesforce is world’s game changing technology and CRM cloud software addresses all your customer interface concerns. It is a company specializing in software as a service.
Salesforce.com is a global cloud computing company which has also expanded into commercial applications of social networking through acquisition. Salesforce.com is generally used to refer to the CRM functionality (the sales, service and marketing applications) and Force.com is generally used to refer to the underlying platform (the database, code, and UI on which all the apps are built). i.e. Force.com is a platform where you can develop your own application.
Salesforce.com is Sales(CRM) and Service applications which were developed and running on the Force.com Platform.
Salesforce.com is SaaS(software as a service) and Force.com is Paas. Force.com is Salesforce.com’s cloud computing platform as a service (PaaS) development framework.
Salesforce.com CRM is broken down into several sections:
Sales Cloud
Service Cloud
Data Cloud
Marketing Cloud
Collaboration Cloud(including Chatter)
Analytics Cloud
And Custom Cloud (including Force.com)
Girikon provides Best Salesforce Consulting Services.
Cheers!
Pramod