function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mshelmanmshelman 

Develop AccountEditor locally

 I'm a bit confused about that statement in the Mobile Development guide:

 

"Developing a hybrid application inside the container requires a build/deploy step for every change. For that reason, we
recommend you develop your hybrid application directly in a browser, and only run your code in the container in the final
stages of testing. JavaScript development in a browser is easier because there is no build/compile step. Whenever you make changes to the code, you can refresh the browser to see your changes."

 

I assume this means setting up all the static resources within a VF page or an external web site for say, the AccountEditor app which I have working in the emulator? Is there an easy way to do this from forcedroid,  or some sample code?

Best Answer chosen by Admin (Salesforce Developers) 
WolfMWolfM

You can actually run AccountEditor.html in a browser (preferably Chrome). That way you can use the browser dev tools to debug / step through code etc.

To do that.

 

1) Clone or fork the repo where AccountEditor lives: https://github.com/forcedotcom/SalesforceMobileSDK-Shared. 

2) Edit AccountEditor.html (it's in the SampleApps/smartsync directory).

Uncomment the block of script includes between <!-- Local Testing --> and <!-- End Local Testing --> and make sure to comment out the script includes between <!-- Container --> and <!-- End Container -->. That way you will use mock implementations of cordova and smartstore which will allow you to run outside the container.

3) Then edit auth_local.js and put in a valid refresh token in the creds = {... } section. 

4) Start a browser with same origin policy disabled (for chrome, here are the instructions http://stackoverflow.com/questions/3102819/chrome-disable-same-origin-policy).

5) Simply open file:// <path to >/AccountEditor.html in the browser you just started.

 

Hope that helps.

All Answers

WolfMWolfM

You can actually run AccountEditor.html in a browser (preferably Chrome). That way you can use the browser dev tools to debug / step through code etc.

To do that.

 

1) Clone or fork the repo where AccountEditor lives: https://github.com/forcedotcom/SalesforceMobileSDK-Shared. 

2) Edit AccountEditor.html (it's in the SampleApps/smartsync directory).

Uncomment the block of script includes between <!-- Local Testing --> and <!-- End Local Testing --> and make sure to comment out the script includes between <!-- Container --> and <!-- End Container -->. That way you will use mock implementations of cordova and smartstore which will allow you to run outside the container.

3) Then edit auth_local.js and put in a valid refresh token in the creds = {... } section. 

4) Start a browser with same origin policy disabled (for chrome, here are the instructions http://stackoverflow.com/questions/3102819/chrome-disable-same-origin-policy).

5) Simply open file:// <path to >/AccountEditor.html in the browser you just started.

 

Hope that helps.

This was selected as the best answer
mshelmanmshelman

Thanks, that was exactly what I was looking for

mobile1.390759152613193E12mobile1.390759152613193E12
Hi Guys, 

I also am having issues on making the Account Editor work locally with MockSmartstore. 
On point 3 of WolfM, how do I get a valid refresh token that I can copy paste in the auth_local.js?
Thanks a lot

Maurizio. 
mshelmanmshelman
The way I got the refresh token was by running the AccountEditor in the Android emulator in debug mode. I set a breakpoint in getAuthCredentials and the refresh token is in the returned JSON. 
mobile1.390759152613193E12mobile1.390759152613193E12
Thanks a lot, it worked
@altius_rup@altius_rup
I couldn't find the refresh token in debug point on getAuthCredentials, in iOS : has anyone got another suggestion ?
Rup