You need to sign in to do that
Don't have an account?
Prakhar K
salesforce sdk sample projects
Sir I wanted to learn from SampleApps that salesforce has provided in their SDK,but the one which are posted on GitHub are full of errors and people have done so much editing even in SalesforceSDK libraries.It would be nice if you kindly post thelink or provide the original SDK Sample Apps .so that I can learn from it.
Thankyou!!!
Thankyou!!!
You may want to look at the commit history for both repos below.
https://github.com/forcedotcom/SalesforceMobileSDK-Android/commits/master
https://github.com/forcedotcom/SalesforceMobileSDK-iOS/commits/master
Let me know if you are facing any specific errors and I'll be happy to help.
Regards,
Gaurav
In contact explorer app (Hybrid) (Android) onDeviceReady function is not firing?
After compiling and running the contact explorer sample app (hybrid), in index.html the onDeviceReady function is not firing nor it is giving any error in logCat in eclipse ADT?
I am using cordova 2.2.0.js using API 16 4.1.2 ?below is the code of index.html
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0; user-scalable=no" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="jquery/jquery.mobile-1.3.1.min.css" />
<script src="jquery/jquery-2.0.0.min.js"></script>
<script src="jquery/jquery.mobile-1.3.1.min.js"></script>
<script src="cordova-2.2.0.js"></script>
<script src="cordova.force.js"></script>
<script src="forcetk.mobilesdk.js"></script>
<style>
.logWindow {display:none; width:700px;}
.logWindow > p {padding:0px; margin:0px; word-wrap:break-word;}
</style>
<script>
// The version of the REST API you wish to use in your app.
var apiVersion = "v28.0";
var forcetkClient;
var debugMode = true;
var logToConsole = cordova.require("salesforce/util/logger").logToConsole;
jQuery(document).ready(function() {
//Add event listeners and so forth here
logToConsole("onLoad: Hii jquery ready");
logToConsole("onLoad:before");
document.addEventListener("deviceready",onDeviceReady,false); //not firing,no error in LogCat and in console//
logToConsole("onLoad:After");
});
// When this function is called, Cordova has been initialized and is ready to roll
function onDeviceReady() {
logToConsole("onDeviceReady: Cordova ready");
//Call getAuthCredentials to get the initial session credentials
cordova.require("salesforce/plugin/oauth").getAuthCredentials(salesforceSessionRefreshed, getAuthCredentialsError);
//register to receive notifications when autoRefreshOnForeground refreshes the sfdc session
document.addEventListener("salesforceSessionRefresh",salesforceSessionRefreshed,false);
//enable buttons
regLinkClickHandlers();
}
function salesforceSessionRefreshed(creds) {
logToConsole("salesforceSessionRefreshed");
// Depending on how we come into this method, `creds` may be callback data from the auth
// plugin, or an event fired from the plugin. The data is different between the two.
var credsData = creds;
if (creds.data) // Event sets the `data` object with the auth data.
credsData = creds.data;
forcetkClient = new forcetk.Client(credsData.clientId, credsData.loginUrl, null,
cordova.require("salesforce/plugin/oauth").forcetkRefresh);
forcetkClient.setSessionToken(credsData.accessToken, apiVersion, credsData.instanceUrl);
forcetkClient.setRefreshToken(credsData.refreshToken);
forcetkClient.setUserAgentString(credsData.userAgent);
}
function getAuthCredentialsError(error) {
logToConsole("getAuthCredentialsError: " + error);
}
</script>
<!-- load our app-specific code -->
<script src="/inline/inline.js">
alert('invoking callMe of inline.js ...');
callMe();
</script>
</head>
<body>
<div data-role="page" data-theme="b" id="jqm-home">
<div data-role="header">
<h1>Hybrid REST Explorer (SalesforceMobileSDK + Cordova + JQM)</h1>
</div>
<div id="#content" data-role="content">
<p><a href="#" id="link_fetch_device_contacts" data-role="button" data-inline="true">Fetch Device contacts</a></p>
<p><a href="#" id="link_fetch_sfdc_contacts" data-role="button" data-inline="true">Fetch SFDC contacts</a></p>
<p><a href="#" id="link_fetch_sfdc_accounts" data-role="button" data-inline="true">Fetch SFDC Accounts</a></p>
<p><a href="#" id="link_reset" data-role="button" data-inline="true">Reset</a></p>
<p><a href="#" id="link_logout" data-role="button" data-inline="true">Logout</a></p>
<div id="div_device_contact_list"></div>
<div id="div_sfdc_contact_list"></div>
<div id="div_sfdc_account_list"></div>
<h3>console:</h3>
<p id="console" class="logWindow">
</p>
</div>
</div>
</body>
</html>
I actually found http://www.salesforce.com/us/developer/docs/salesforce_platform_mobile_services/salesforce_platform_mobile_services.pdf very useful - if you use "Mobile SDK npm Packages" on page 18 (for iOS) to install forceios globaly, you will be able to use command "forceios samples" described in page 24. I am not 100% sure that I went through those samples, but generating fresh app using "/node_modules/.bin/forceios create" (dsecribed on page 99 for iOS) did help me a lot, as it bascially generates complete project where you can call API's. It looks like it's a very similar procedure on Android.
Only thing I really needed is connected app key and URI I did create before.
Hope it helps.
Thanks,
J