Search code examples
androidgoogle-play-servicesactivity-recognitionneura

Not receiving accessToken and RESULT_OK on onActivityResult when using Neura sdk


I'm using NeuraSdk in order to detect user events (user arrived home, user left work, etc).

I'm trying to login with their sdk, and even though the login looks successful and i enter the right sms code with the phone, the accessToken isn't received on onActivityResult(...), the resultCode = 0(RESULT_CANCELED) and not 1=(RESULT_OK) as it should be.

Here's my onActivityResult() :

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == FragmentActivity.RESULT_OK) {
        Log.i(getClass().getSimpleName(), "Successfully logged in with accessToken : "
                + SDKUtils.extractToken(data));
    } else {
        Log.i(getClass().getSimpleName(), "Failed to login and receive accessToken");
    }
}

Solution

  • Your package name as listed on the gradle should be corallate with the package name listed on your gradle.

    For example, in the neura devsite if i have : app_details

    Then check that your gradle has the exact same package name under defaultConfig :

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 22
        applicationId "com.pul.dmg"
    }