Git Product home page Git Product logo

Comments (3)

minbi avatar minbi commented on August 23, 2024 1

Hi @Trivoc ,

You will need to call AWSMobileClient.getInstance().initialize(Context, Callback<UserStateDetails>) before making calls to any of the other functions.

Also, for the showSignIn there is a requirement to pass in the options for now. (We will look into fixing it in a release.)

AWSMobileClient.getInstance().showSignIn(this, SignInUIOptions.builder()
        .logo(R.drawable.default_sign_in_logo) // This logo is available through the library
        .backgroundColor(R.color.colorPrimaryDark) // This color should be generic to Android, but you may choose another
        .canCancel(true)
        .build(), new Callback<UserStateDetails>() {
    @Override
    public void onResult(UserStateDetails userStateDetails) {
        Log.d(TAG, "onResult: showSignIn " + userStateDetails.getUserState());
    }

    @Override
    public void onError(Exception e) {
        Log.e(TAG, "onError: showSignIn", e);
    }
});

from docs.

frankmuellr avatar frankmuellr commented on August 23, 2024

Hello @Trivoc,

Issue has been fixed
#179 (comment)

Please review.

from docs.

Trivoc avatar Trivoc commented on August 23, 2024

Hello,

Thank you for the update. Attempting the new snippet resulted in a thrown exception with trace:

W/System.err: java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String android.content.SharedPreferences.getString(java.lang.String, java.lang.String)' on a null object reference
        at com.amazonaws.mobile.client.AWSMobileClient.getSignInDetailsMap(AWSMobileClient.java:566)
        at com.amazonaws.mobile.client.AWSMobileClient.getUserStateDetails(AWSMobileClient.java:583)
        at com.amazonaws.mobile.client.AWSMobileClient$19.run(AWSMobileClient.java:1907)
        at com.amazonaws.mobile.client.internal.InternalCallback.await(InternalCallback.java:106)
        at com.amazonaws.mobile.client.AWSMobileClient.showSignIn(AWSMobileClient.java:1896)
        at com.example.trivoc.testaws.MainActivity.onCreate(MainActivity.java:43)
        at android.app.Activity.performCreate(Activity.java:7136)
        at android.app.Activity.performCreate(Activity.java:7127)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)

from docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.