facebook - Android - No Activity found to handle Intent when opening FB native app -
i'm trying open fb app on specific post url received in notification.
it work on devices crashes on samsung s7. simple code:
string url = "fb://post/<post_id>"; uri target = uri.parse(url); notifintent = new intent(intent.action_view, target); startactivity(notifintent);
i checked before fb exists on device:
packagemanager packagemanager = context.getpackagemanager(); try { int versioncode = packagemanager.getpackageinfo("com.facebook.katana", 0).versioncode; return "fb://post/" + fb_url; } catch (packagemanager.namenotfoundexception e) { return "https://www.facebook.com/" + fb_url; //normal web murl }
the error log:
fatal exception: java.lang.runtimeexception: unable start activity componentinfo{snip.snipnotifier/snip.snipnotifier.loadingactivity}: android.content.activitynotfoundexception: no activity found handle intent { act=android.intent.action.view dat=fb://post/<post_id> } @ android.app.activitythread.performlaunchactivity(activitythread.java:3149) @ android.app.activitythread.handlelaunchactivity(activitythread.java:3248) @ android.app.activitythread.access$1000(activitythread.java:197) @ android.app.activitythread$h.handlemessage(activitythread.java:1681) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:145) @ android.app.activitythread.main(activitythread.java:6872) @ java.lang.reflect.method.invoke(method.java) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1404) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1199) caused android.content.activitynotfoundexception: no activity found handle intent { act=android.intent.action.view dat=fb://post/251996958535784_295668917501921 } @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1817) @ android.app.instrumentation.execstartactivity(instrumentation.java:1515) @ android.app.activity.startactivityforresult(activity.java:4076) @ android.support.v4.app.basefragmentactivityjb.startactivityforresult(basefragmentactivityjb.java:48) @ android.support.v4.app.fragmentactivity.startactivityforresult(fragmentactivity.java:75) @ android.app.activity.startactivityforresult(activity.java:4023) @ android.support.v4.app.fragmentactivity.startactivityforresult(fragmentactivity.java:856) @ android.app.activity.startactivity(activity.java:4347) @ android.app.activity.startactivity(activity.java:4315) @ snip.snipnotifier.loadingactivity.oncreate(loadingactivity.java:29) @ android.app.activity.performcreate(activity.java:6550) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1120) @ android.app.activitythread.performlaunchactivity(activitythread.java:3102) @ android.app.activitythread.handlelaunchactivity(activitythread.java:3248) @ android.app.activitythread.access$1000(activitythread.java:197) @ android.app.activitythread$h.handlemessage(activitythread.java:1681) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:145) @ android.app.activitythread.main(activitythread.java:6872) @ java.lang.reflect.method.invoke(method.java) @ java.lang.reflect.method.invoke(method.java:372) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:1404) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:1199)
would appreciate help.
since there no activity handle intent in samsung s7 .you have check first through this.
if (sendintent.resolveactivity(getpackagemanager()) != null) { startactivity(sendintent); }
hope help.happy coding.
Comments
Post a Comment