ARouter版本:
implementation.alibaba:arouter-api:1.4.0'
annotationProcessor'com.alibaba:arouter-compiler:1.2.1'
场景:
集成完毕 app running
调用ARouter.getInstance().build(url).navigation;
后无法跳转界面 而使用startActivity能够正常跳转界面
如果实现了IInterceptor 接口即使不在path中添加extras属性仍会走入拦截器中
(在此之前一直以为需要手动调用extras属性才会启用拦截)
@Route(path = RouterUrl.STUDENT_CHOOSE_LOGIN_METHOD,extras = RouterExtras.EXTRA_COMMON)
public class ChooseLoginMethodAct extends BaseActivity {
所以需要在实现类中手动调用
callback.onContinue(postcard);
@Interceptor(priority = 1)
public class LoginInterceptor implements IInterceptor {
/**
* The operation of this tollgate.
*
* @param postcard
* meta
* @param callback
* callback
*/
@Override
public void process(Postcard postcard, InterceptorCallback callback) {
// 是否需要登录
// if (RouterExtras.EXTRA_LOGIN == postcard.getExtra()) {
// // 是否已经登录
// if (UserLogic.isLand()) {
// callback.onContinue(postcard);
// } else {
// ARouter.getInstance().build(RouterUrl.USER_LOGIN).navigation();
// callback.onInterrupt(null);
// }
// } else {
// callback.onContinue(postcard);
// }
callback.onContinue(postcard);
}
/**
* Do your initScratch work in this method, it well be call when processor has been load.
*
* @param context
* context
*/
@Override
public void init(Context context) {
}
}