Skip to main content

Mobile Application Development On Touch Platform-Part 2

This blog post is in continuation with Earlier blog post where we explored  some limitations of standard apps provided by salesforce .But every release salesforce keeps improving Salesforce Touch App ,Salesforce Mobile etc and hence its advisable to go through latest release to find out whether the customers requirement can be met from using those standard app and figure out actual need to go for development of completely customized app. Touch Platform offers Salesforce SDK for Android and IOS .Using SDK its possible to develop native ,hybrid or an HTML web application.

There are lot of discussions around which type of application is best. (Hybrid or native or html).The conclusion it really depends on the requirement,developer resource and performance expected .

Native Apps are faster and provides great offline support but we may need to code in different languages depending on platform .Eg:Objective C for IOS and Java for Android .

 Hybrid Apps are developed using Javascript libraries and a web developer with Javascript skills along with knowledge of Jquery mobile and Html5 and CSS3 can handle .The Hybrid applications will provide cross platform support and there is a support for offline as well using Smartstore.js that comes bundled with salesforce mobile SDK.

The above link will take you developerforce where you will see the Javascript libraries that can be used to develop Hybrid Application.To mention few these are i)Angular.js ii)Backbone.js iii)Forcetk

JqueryMobile  is an excellent utility and using this the UI of the mobile application can be developed very quickly.This is also one of the components that comes bundled with mobile SDK .

Lets quickly summarize what are the things that comes bundled with the Salesforce SDK and whats there use (Salesforce SDK for Android ,Salesforce SDK for IOS).

a)bootconfig.js-This boots the app as name suggests .This configures the app .

Settings needed in  bootconfig.js for local Hybrid app 

i)remoteAccessConsumerKey -From your remote access settings  or connected apps place your consumer key in this variable 

var remoteAccessConsumerKey = "3MVG9A2kN3Bn17hvZpJm8_imuGQjzehEPJ94DYLTwjIp811dyZUSv3EEU1L0z5TAZHanF4clFyNF_2jygDscB";

ii)oauthRedirectURI-This variable must be populated with the Callback URL from your remote access settings or connected apps 


// The redirect URI value specified for your remote access object that defines
// your application in Salesforce.
var oauthRedirectURI = "testdemo:///mobilesdk/detect/oauth/done";

iii)startData-This is crucial part of configuration.This decides whether you want to land the app on local html (In case you have developed local hybrid application )or On server side visualforce as the first page as soon as app boots up(In case you have developed server side  hybrid application)

For local app use the following:

var startData = new SFHybridApp.LocalAppStartData();  // Used for local REST-based "index.html" PhoneGap apps.

For Visualforce based Server side application use the following

var startData = new SFHybridApp.RemoteAppStartData("/apex/Visualforcepage?context=container"); 

Where VisualforcePage is the name of Visualforce where you want to land the user when the app boots up

NOTE:I will be expanding in my next blog post whats the difference between local side hybrid app and server side hybrid application

b)Cordova-2.3.0.js-This is open source phonegap plugin.To read more about Phonegap refer the following link

We wonder how can i access the device features(Camera,audio,video,geo location,file storage  etc)from Javascript .It is this open source Javascript library that has Javscript functions to invoke the device features.

c)SalesforceOauthPlugin.Js-This handles the authentication of the application using oauth 2.0 of Note oauth 2.0 is necessary only for local hybrid application

d)SFHybridApp.Js-This provides some utility functions necessary for offline caching of data and functions  to detect whether the device is online or offline etc 

e)Jquerymobile -This library eases the creation of UI for the application and makes it platform independent and also device independent .

There are lot to speak about mobile application development on touch platform and surely i fancy blogging more on this .Happy Learning!!!

Popular posts from this blog

Invoking Apex Callout From Process Builder

Process builder is GA in Spring 15 and one of the queries I came across was around how to invoke apex callouts from Process builder .

Before process builder came we had two common approaches of calling webservice 

1)We have outbound messages as one of the Actions for workflows.This works if other party implements the WSDL that is generated once Outbound messaging is defined with appropriate end point .

2)Most of times future method invoked through triggers allowed to do apex callouts and invoke external web service provided the future method is annotated with @future(callout=true).This provides lot of flexibility and one of the best approaches .

3)Flow triggers was in BETA and this was also one of the ways we could invoke callouts provided the Flow implements process plugin .To understand in detail how to implement process plugin refer to the below example

The purpose of this blogpost is to demonstrate the new possibility of invoking apex callout through Process Builder 

I tried initi…

Opening Modal Using Lightning Component Framework of SFDC

One of my friend from India threw a challenge .The challenge was to open a modal by using latest and greatest lightning components framework and modals design from SLDS .For the love of community I thought of sharing the entire code base that I did .

So here we start ..

Business Use Case - Need a handy SalesLeader board component that can be used to display the Sales revenue generated by each sales rep for current year in the order of decreasing total revenue .On click of the tile ,we will show detail opportunity list aggregating the revenue .

The component can be dragged in lightning design experience or in App builder lightning Page .

Video Demonstration-

SalesLeaderBoard from Mohith Kumar Shrivastava on Vimeo.

Frameworks Used -
Lightning Design Systems (SLDS) for CSSLightning Component Framework for client side logicApex aura enabled class for backend logicApproach
The component hierarchy is very important to imagine or mindmap before we dig deeper- SalesLeaderMain

Writing Test Classes For Apex Rest Service

I came across a question in a developer community on how to write Unit Test Classes for the Rest API service for POST HTTP calls

Unit Test Classes for REST API following link is very useful and inspired by this jeff had an article on his blog on how to write the test method for same .

Here is the Jeff Blog Link Test Class for REST API(Good reference for GET Rest Services)

In one of my previous blog post i demonstrated how to use native parsing technique for Rest api for User Defined Type
I wrote the Test class for the same and this post is helpful for all those searching for how to write test classes for apex rest service annotated with POST Call
Here is the Rest Service Class for which i attempted the test class
@RestResource(urlMapping='/DemoUrl/*') global with sharing class MyRestResourcedemo { global class RequestWrapper{ public Account acct; public Contact[] cons; } global class ResponseWrapper { public String StatusCode; …