0

I'm getting a null point exception in Android studio. I'm trying to integrate Helpshift into my current app. The null point is being called on the help button I think. The error I'm getting is:

java.lang.NullPointerException: Attempt to invoke interface method 
'void com.helpshift.CoreApi.updateApiConfig(java.util.Map)' on a null object reference

My code looks like

package com.example.leoconnelly.connexus;




public class MainActivity extends AppCompatActivity {

ImageButton FindCareButton;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


//THE PURPLE BUTTON!!!!!!!
    FindCareButton = (findViewById(R.id.find_care_button));

    FindCareButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            openFindCare();
        }
    });

    /*
    GetStartedButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            openSearchActivity();
        }
    });
     */

    ImageButton helpButton = (ImageButton) findViewById(R.id.imageButton13);
    helpButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ApiConfig.Builder configBuilder = new ApiConfig.Builder();
            configBuilder.setRequireEmail(true);
            configBuilder.setEnableTypingIndicator(true);
            com.helpshift.support.Support.showConversation(MainActivity.this, configBuilder.build() );


        }
    });


}

public void openFindCare () {
   Intent mainActivityToFindCare = new Intent (this, 
HealthCenterListActivity.class);
    startActivity(mainActivityToFindCare);
}

}

I'm not exactly sure what it's pointing too. I'm trying to open FAQs from Helpshift.

Grokify
  • 15,092
  • 6
  • 60
  • 81
  • Seems like you missed something. Just follow the [Sample](https://github.com/helpshift/helpshift-android-sdk-examples) and [Documentation](https://developers.helpshift.com/android/getting-started/). – ADM Apr 19 '18 at 05:46
  • I know I just can't figure out what. – Leo Connelly Apr 19 '18 at 05:52

1 Answers1

0

You are missing the InstallConfig for the API. Try adding it in the Calling Activity.

import com.helpshift.Core;
import com.helpshift.All;
import com.helpshift.InstallConfig;
import com.helpshift.exceptions.InstallException;

Core.init(All.getInstance());
        InstallConfig installConfig = new InstallConfig.Builder()
                .setEnableInAppNotification(true)
                .build();

        try {
            Core.install(getApplication(),
                    API_KEY,
                    DOMAIN,
                    APP_ID, installConfig);


        } catch (InstallException e) {
            android.util.Log.e("Helpshift", "install call : ", e);
        }
Fawzan
  • 4,738
  • 8
  • 41
  • 85