1

I am new to salesforce i have to interface salesforce with my android app. I am following this tutorial Interfacing Salesforce with Android

I have successfully created connected app on salesforce now i am creating android i have followed above tutorial and official salesforce documentation.

I have tried following

I have added cordova and salesforce sdk to my android project Created bootconfig.xml in values folder with my connected app details

<string name="remoteAccessConsumerKey">3MVG9ZL0ppGP5UrBxQwpiktQclW3vqaOIgDE9XorTmWJ.VoMDc_53UJLeQFrTH.FYD_jsBH8TzhAO3YWRbxSJ

sfdc://helloworld chatter_api

My application class implementation is following public class BSDApplication extends Application {

class KeyImpl implements KeyInterface {


    @Override
    public String getKey(String name) {
        return Encryptor.hash(name + "12s9adpahk;n12-97sdainkasd=012", name + "12kl0dsakj4-cxh1qewkjasdol8");

    }
}

@Override
public void onCreate() {
    super.onCreate();
    Toast.makeText(getApplicationContext(),"inside oncreate",Toast.LENGTH_LONG).show();
    Log.d("BSDAPP", "before login for salesforce");
    try {
        SalesforceSDKManager.initNative(getApplicationContext(), new KeyImpl(), MainActivity.class);
    }
    catch (Exception e)
    {
        Log.d("BSDAPP","salesforceException "+e.getMessage());
    }
    Log.d("BSDAPP","login for salesforce");
}

}

I can see the logs but as per documentation before proceeding my app's Main activity class it should display login screen but it directly move to my screen. What i am missing here? Any help any suggestion will be appreciated.

1 Answer 1

0

Need to add MainApplication.java to your project

and give this class in Manifest file

/** * Application class for our application. */

public class MainApplication extends Application {

@Override
public void onCreate() {
    super.onCreate();
    SmartSyncSDKManager.initNative(getApplicationContext(), new NativeKeyImpl(), MainActivity.class);

    /*
     * Uncomment the following line to enable IDP login flow. This will allow the user to
     * either authenticate using the current app or use a designated IDP app for login.
     * Replace 'idpAppURIScheme' with the URI scheme of the IDP app meant to be used.
     */
    // SmartSyncSDKManager.getInstance().setIDPAppURIScheme(idpAppURIScheme);

    /*
     * Un-comment the line below to enable push notifications in this app.
     * Replace 'pnInterface' with your implementation of 'PushNotificationInterface'.
     * Add your Google package ID in 'bootonfig.xml', as the value
     * for the key 'androidPushNotificationClientId'.
     */
    // SmartSyncSDKManager.getInstance().setPushNotificationReceiver(pnInterface);
}

}

class NativeKeyImpl implements KeyInterface {

@Override
public String getKey(String name) {
    return Encryptor.hash(name + "12s9adpahk;n12-97sdainkasd=012", name + "12kl0dsakj4-cxh1qewkjasdol8");
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .