klarna / klarna-on-demand-android

Klarna On Demand SDK for Android
Other
8 stars 4 forks source link

Resuming registration with no background processes crashes in RegistrationActivity #35

Open zippert opened 7 years ago

zippert commented 7 years ago

If user has disallowed background-processes on Android device (Settings->Developer options->Background process limit->"No Background processes") and exits launching(/host) application after setting context:

com.klarna.ondemand.Context.setApiKey(apiKey);

and launching the RegistrationActivity:

        Intent intent = new Intent(this, RegistrationActivity.class);
        RegistrationSettings settings = new RegistrationSettings(normalizedNumber, confirmedUserDataId);
        intent.putExtra(RegistrationActivity.EXTRA_SETTINGS, settings);
        startActivityForResult(intent, REGISTRATION_REQUEST_CODE);

When the "Klarna-logo" is shown, press home and open another application. Then bring up the (host) application via "Recent apps". Application crashes:

03-28 11:06:10.784 2841 2841 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{se.skanetrafiken.washington.dev/com.klarna.ondemand.RegistrationActivity}: java.lang.RuntimeException: You must set the API key first. 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2464) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2524) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:154) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.os.Looper.loop(Looper.java:234) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5526) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: Caused by: java.lang.RuntimeException: You must set the API key first. 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at com.klarna.ondemand.Context.getApiKey(Context.java:25) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at com.klarna.ondemand.UrlHelper.getAuthority(UrlHelper.java:15) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at com.klarna.ondemand.UrlHelper.registrationUrl(UrlHelper.java:24) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at com.klarna.ondemand.RegistrationActivity.getUrl(RegistrationActivity.java:32) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at com.klarna.ondemand.RegistrationActivity.onCreate(RegistrationActivity.java:28) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6285) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417) 03-28 11:06:10.784 2841 2841 E AndroidRuntime: ... 9 more

When switching back (where the crash occurs), the Klarna-Activity receives focus and cannot be prevented/fixed from the host application.

danevron commented 7 years ago

This issue is addressed in #36

zippert commented 7 years ago

When will this be made as a deliverable to us?

danevron commented 7 years ago

It should be already available.

Best, Dan

On Fri, Mar 31, 2017 at 9:44 AM Mattias Zippert notifications@github.com wrote:

When will this be made as a deliverable to us?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/klarna/klarna-on-demand-android/issues/35#issuecomment-290630706, or mute the thread https://github.com/notifications/unsubscribe-auth/ABl9ecpxtE8wwnqAA9kJ1Fh9_b6v0aEZks5rrKC5gaJpZM4MrXTH .