This blog post tries to help mobile developers using HTML5, Javascript to develop mobile web pages using Lightning, Visualforce for S1 or Salesforce Mobile SDK. This post is targeted towards Android based devices only, in next post we will cover iOS and Safari based remote debugging as well.
How to start ?
1. Please go thru this official article from Google to understand remote debugging requirements, and how to enable it on your mobile device.
2. Once you have done that, please watch this video to see how Salesforce 1 or Hybrid apps can be debugged on Android via remote debugging.
Key steps
- Connect your Android device via USB Cable to your machine.
- Enabled USB Debugging (as explained in this guide).
- Goto this URL in Chrome : chrome://inspect/#devices.
- Open Salesforce 1 in chrome browser, not the Salesforce 1 app.
- If you are debugging Salesforce Mobile SDK hybrid app, add following line to MainActivity of your generated app, ad indicated below:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { android.webkit.WebView.setWebContentsDebuggingEnabled(true); }
Full Source
public class CordovaApp extends CordovaActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { android.webkit.WebView.setWebContentsDebuggingEnabled(true); } // Set by in config.xml loadUrl(launchUrl); } }
- You will see your chrome browser app or hybrid app in this tab now : chrome://inspect/#devices
- Please follow steps in video to debug further.
Upvote this idea
Part 2
We will explore remote debugging via Safari for iOS.
Leave a Reply