line / line-sdk-android

LINE SDK for Android lets you integrate LINE into your Android app to create a more engaging experience for your users.
https://developers.line.biz/en/docs/android-sdk/
Apache License 2.0
134 stars 45 forks source link

check if intent can be handled before passing to activity #83

Closed plateaukao closed 4 years ago

plateaukao commented 4 years ago

Issue

Sometimes, app encounters ActivityNotfoundException when trying to login by installed LINE app.

LineApiError{httpResponseCode=-1, message='android.content.ActivityNotFoundException: No Activity found to handle Intent
{ act=android.intent.action.VIEW dat=https://access.line.me/... pkg=jp.naver.line.android }

at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1805)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1514)
at android.app.Activity.startActivityForResult(Activity.java:3950)
at android.app.Activity.startActivityForResult(Activity.java:3911)
at android.app.Activity.startActivity(Activity.java:4234)
at com.linecorp.linesdk.auth.internal.LineAuthenticationController$RequestTokenRequestTask.onPostExecute()
...

Solution

Check if system has component to handle the intent before passing out the created intent.