SOLVED

Android SDK MktoException

Go to solution
client-services
Level 1

Android SDK MktoException

I've followed the documentation on implementing the Marketo native SDK for react native (https://developers.marketo.com/mobile/react-native/)

There are mistakes and omissions in the documentation sample code, which for Android seems to have some portion of code samples cut and pasted from React-Native's documentation on implementing a Native Module. 
Through trial and error, I've been able to figure out much of what the documentation is missing that was causing errors in doing a build for android.

However, I'm stuck on the use of the '
MktoException' class in the example 

RNMarketoModule:
   @ReactMethod
   public void associateLead(ReadableMap leadData) {

       MarketoLead mLead = new MarketoLead();
       try {
           mLead.setCity(leadData.getString(MarketoLead.KEY_CITY));
           mLead.setFirstName(leadData.getString(MarketoLead.KEY_FIRST_NAME));
           mLead.setLastName(leadData.getString(MarketoLead.KEY_LAST_NAME));
           mLead.setAddress(leadData.getString(MarketoLead.KEY_ADDRESS));
           mLead.setEmail(leadData.getString(MarketoLead.KEY_EMAIL));
           mLead.setBirthDay(leadData.getString(MarketoLead.KEY_BIRTHDAY));
           mLead.setCountry(leadData.getString(MarketoLead.KEY_COUNTRY));
           mLead.setFacebookId(leadData.getString(MarketoLead.KEY_FACEBOOK));
           mLead.setGender(leadData.getString(MarketoLead.KEY_GENDER));
           mLead.setState(leadData.getString(MarketoLead.KEY_STATE));
           mLead.setPostalCode(leadData.getString(MarketoLead.KEY_POSTAL_CODE));
           mLead.setTwitterId(leadData.getString(MarketoLead.KEY_TWITTER));
           marketoSdk.associateLead(mLead);
       }
       catch (MktoException e){
       }
   }

I was able to figure out how add an import statement for all the other methods referenced (example: 
import com.marketo.Marketo;
import com.marketo.MarketoLead;
)
but there doesn't appear to be an instance of '
com.marketo.MktoException' nor is there a MktoException subclass of any of the other classes I've successfully imported.
MktoException is evidently a class used in the SDK as it is used in a couple of code examples in the documentation but there is no example of how/where to find or import it so it can be properly referenced and used.

Any suggestions?



1 ACCEPTED SOLUTION

Accepted Solutions
client-services
Level 1

Re: Android SDK MktoException

In case anyone else runs into this, the correct import for the 'MktoException' class is: 

import com.marketo.errors.MktoException;

 

View solution in original post

2 REPLIES 2
client-services
Level 1

Re: Android SDK MktoException

In case anyone else runs into this, the correct import for the 'MktoException' class is: 

import com.marketo.errors.MktoException;

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Android SDK MktoException

Appreciate you keeping the thread updated. Not many users of the Android SDK on here, so probably not many anywhere!