Updating Facebook SDK Android -
i using old version of facebook android sdk (i think v 3.0.1) quite while until got problem loging in through facebook.
i getting error in stack trace
:
java.lang.runtimeexception: unable resume activity {com.example/com.facebook.loginactivity}: java.lang.illegalargumentexception: service intent must explicit: intent { act=com.facebook.platform.platform_service cat=[android.intent.category.default] } @ android.app.activitythread.performresumeactivity(activitythread.java:2958) @ android.app.activitythread.handleresumeactivity(activitythread.java:2989) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2372) @ android.app.activitythread.access$800(activitythread.java:148) @ android.app.activitythread$h.handlemessage(activitythread.java:1283) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5274) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:909) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:704) caused by: java.lang.illegalargumentexception: service intent must explicit: intent { act=com.facebook.platform.platform_service cat=[android.intent.category.default] } @ android.app.contextimpl.validateserviceintent(contextimpl.java:1745) @ android.app.contextimpl.bindservicecommon(contextimpl.java:1844) @ android.app.contextimpl.bindservice(contextimpl.java:1822) @ android.content.contextwrapper.bindservice(contextwrapper.java:538) @ com.facebook.gettokenclient.start(gettokenclient.java:62) @ com.facebook.authorizationclient$gettokenauthhandler.tryauthorize(authorizationclient.java:535) @ com.facebook.authorizationclient.trycurrenthandler(authorizationclient.java:214) @ com.facebook.authorizationclient.trynexthandler(authorizationclient.java:193) @ com.facebook.authorizationclient.authorize(authorizationclient.java:121) @ com.facebook.authorizationclient.startorcontinueauth(authorizationclient.java:102) @ com.facebook.loginactivity.onresume(loginactivity.java:113) @ android.app.instrumentation.callactivityonresume(instrumentation.java:1241) @ android.app.activity.performresume(activity.java:6063) @ android.app.activitythread.performresumeactivity(activitythread.java:2947) ... 11 more java.lang.illegalargumentexception: service intent must explicit: intent { act=com.facebook.platform.platform_service cat=[android.intent.category.default] } @ android.app.contextimpl.validateserviceintent(contextimpl.java:1745) @ android.app.contextimpl.bindservicecommon(contextimpl.java:1844) @ android.app.contextimpl.bindservice(contextimpl.java:1822) @ android.content.contextwrapper.bindservice(contextwrapper.java:538) @ com.facebook.gettokenclient.start(gettokenclient.java:62) @ com.facebook.authorizationclient$gettokenauthhandler.tryauthorize(authorizationclient.java:535) @ com.facebook.authorizationclient.trycurrenthandler(authorizationclient.java:214) @ com.facebook.authorizationclient.trynexthandler(authorizationclient.java:193) @ com.facebook.authorizationclient.authorize(authorizationclient.java:121) @ com.facebook.authorizationclient.startorcontinueauth(authorizationclient.java:102) @ com.facebook.loginactivity.onresume(loginactivity.java:113) @ android.app.instrumentation.callactivityonresume(instrumentation.java:1241) @ android.app.activity.performresume(activity.java:6063) @ android.app.activitythread.performresumeactivity(activitythread.java:2947) @ android.app.activitythread.handleresumeactivity(activitythread.java:2989) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2372) @ android.app.activitythread.access$800(activitythread.java:148) @ android.app.activitythread$h.handlemessage(activitythread.java:1283) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:135) @ android.app.activitythread.main(activitythread.java:5274) @ java.lang.reflect.method.invoke(native method) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:909) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:704)
if login facebook through android lollipop device has facebook apps installed in it.
i avoiding issue changing sessionloginbehavior
using code currently
public void loginfacebook(){ session session = new session(context); session.setactivesession(session); session.openrequest openrequest = null; if (fragment != null) { openrequest = new session.openrequest(fragment); } else if (context instanceof activity) { openrequest = new session.openrequest((activity)context); } if (openrequest != null) { openrequest.setdefaultaudience(sessiondefaultaudience.friends); openrequest.setpermissions(arrays.aslist("email", "user_birthday")); //openrequest.setloginbehavior(sessionloginbehavior.sso_with_fallback); // native login changed if (build.version.sdk_int >= build.version_codes.lollipop) { // lollipop force login website openrequest.setloginbehavior(sessionloginbehavior.suppress_sso); } else { // below lollipop login fallback openrequest.setloginbehavior(sessionloginbehavior.sso_with_fallback); } session.openforread(openrequest); } }
if changed facebook sdk v. 4.1.1, got lot of error because lot of import
facebook sdk isn't there anymore int v 4.1.1
what should fix issue without changing sessionloginbehavior
, should stay current fix implementation or else?
Comments
Post a Comment