I'm developing a hybrid android app, and I'd like to test everything in a regular desktop browser first because the android emulator is incredibly slow in deploying. The problem is that in the emulator I am asked for identification when I build the first time, but when I just run the index.html in a browser, I am not. This leads to the forcetk client being undefined and all the problems that entails. Is there a way to include logging in to Salesforce in this type of local testing as well?


I've faced this issue as well over the years. The SDK does NOT directly support testing your hybrid apps on the browser because the oAuth dance happens via a WebView that's triggered by Cordova specific APIs such as onDeviceReady which fire only on the phone (device/ emu). This is the reason why you typically get the forcetk undefined on your browser while it works on devices/ emulator as it's handled by Mobile SDK using Cordova under the hood.

Having mentioned that, I believe it should be possible to do so if you can modify the auth flow to manage forcetk instantiation in your custom code while bypassing the Mobile SDK oAuth dance - however that can be a bit complex.

| improve this answer | |

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.