4

I'm a mobile app developer. And my task is to develop mobile apps based on the existing website that uses salesforce. So, basically the same functionalities on the website to be used for native mobile apps(iOS and Android). The existing website that uses force.com is for consumer, meaning it is accessible to public.

So, I thought i have few options on integrating salesforce data with mobile apps.

1) Using native mobile SDK

At first, I thought it might be easier to use native mobile SDK but i found out you need to do authentications in order to get the data. Not sure if its possible to bypass authentication to get the data. Is this possible or not? Also, I think I need to build query style statements to retrieve the data. And to get most of the data, i need to build complex query i think.

2) REST API

Then I investigate if using REST API might solve my issues. I still need to pass authentication but i can use username and password to pass the authentication which is not bad, i think. Not sure how to make it public API though. And also, the simple APIs are already there.

3) REST Apex API

I thought this method might be the best way. You can expose the Apex class functionalities as REST. Since I thought the functions on the website is already there, I can just adjust or duplicate it to include REST functionalities in it. Also, i found tutorial to expose the REST API to public. So, did some testing, it works good for example apps data. But not sure if I can have push notifications for this, or can i?

Now, my questions are:

1) Is my thinking correct in term of which method is the best way to implement to integrate salesforce data of a public website by using REST APEX API instead of using mobile SDK?

2) If my thinking is wrong, what are the best and simple ways then to integrate salesforce data with mobile apps with the scenario of having a public website?

Please note that I'm a Salesforce newbie and the salesforce website is public website, the data are not sensitive. There is also user registration and login on that website. User can post text and image as well.

If you need more information, do let me know. Thanks.

*Added more information below

1) My website is force.com community site. 2) My client doesn't want the same design as the site. They require native mobile apps. 3) If I use native mobile SDK, I agree it would be easier. But is there anyway that: a) I can bypass the authentication of the login? The login use customer community user login b) If i need to authenticate, can I use some sort of REST api to authenticate? Example, myapp.force.com/users/username=&password= Because I don't want the login/register page as url link. I need it to have it native. Currently the mobile sdk need to connect to a webview login first.

Also, can i use REST API to authenticate my customer community user login? Is that possible? Thanks.

3

The question is fairly open ended - you don't really elaborate on what your so-called Salesforce website does and whether it's built using any responsive frameworks or not (meaning how well it renders on phones, tablets etc.). Anyway, here are some best practices/ points to ponder before you make a decision on which approach to take

  1. If you already have a responsive website and all you want to do is to make it available on phones/ websites, you can simply package it in a WebView using Apache Cordova into an Android app (apk) and an iOS app (ipa) - there is absolutely no need to use the Force.com Mobile SDK]
  2. If you want to build it for both iOS and Android, you could use the hybrid approach from Mobile SDK with either of the following methodologies

    • Host pages locally within the app - use any HTML5/ CSS framework with JavaScript and your pages reside locally
    • Point your app to responsive Visualforce pages in your org
  3. Based on your requirements, I don't really see a compelling reason why you would build native apps for both iOS and Android but as Mohit mentioned, that's another alternate.

To answer your other questions

1) Is my thinking correct in term of which method is the best way to implement to integrate salesforce data of a public website by using REST APEX API instead of using mobile SDK?

This would be the option if you chose approach #1 or if you chose to use VF with approach #2. If you chose local pages in #2, or approach #3, it's better to use the Mobile SDK REST wrappers rather than re-invent the wheel.

2) If my thinking is wrong, what are the best and simple ways then to integrate salesforce data with mobile apps with the scenario of having a public website?

This is already answered. One thing to note - if you do end up using the Mobile SDK, it takes care of auth and REST wrappers. However, if all you need is to make your site available on mobile form factors, Mobile SDK is NOT mandatory and you could use approach #1

[Answer updated based on question's updates]

1) My website is force.com community site. 2) My client doesn't want the same design as the site. They require native mobile apps.

It's a common misconception that only native apps are installed on device. Hybrid apps built with Cordova/ other packaging frameworks + HTML5+ JS/CSS are also installed like a native app

3) If I use native mobile SDK, I agree it would be easier. But is there anyway that: a) I can bypass the authentication of the login? The login use customer community user login b) If i need to authenticate, can I use some sort of REST api to authenticate? Example, myapp.force.com/users/username=&password= Because I don't want the login/register page as url link. I need it to have it native. Currently the mobile sdk need to connect to a webview login first.

You can always point your app built using Mobile SDK to point your community URL login page. There is no way to bypass the authentication process itself. If you want to use your own REST API, you'll also need to do oAuth and session management by yourself.

| improve this answer | |
  • Hi Gaurav, thanks for your reply. I editted my post and added more information for this – Syed M Feb 24 '15 at 4:02
2

Since I don't need authentication, For all functionalities needed publicly I would develop a public REST API exposing data .

Here are some samples on how to develop a REST API for public consumption and requires no authentiication

https://developer.salesforce.com/blogs/developer-relations/2012/02/quick-tip-public-restful-web-services-on-force-com-sites.html

You may need Salesforce developer help just to draft necessary services for you so that your native app consumes .

It does not make sense to use Salesforce SDK at this point as you don't need any oauth flow to happen .

Also you mention that you need ability to register and login as well .

For this you need to figure how currently your existing application does registration and login .They may be consuming a community license or some sort of license .

Assuming you consume a license ,you can think of implementing one of oauth flows

https://help.salesforce.com/HTViewHelpDoc?id=remoteaccess_authenticate.htm

Salesforce SDK has implemented this and I believe SDK is open sourced so you can get some code from here to avoid replicating effort to figure .

Also if developing Hybrid application is still an option ,I would go with Hybrid and Build all HTML5 responsive pages using bootstrap.This will require UI skills and SFDC Visualforce Skills .

| improve this answer | |
  • Thanks mohith for your answer. I editted my post and added more information on this. – Syed M Feb 24 '15 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.