onNewIntent() is not called in android Tabs

2020-03-04 06:59发布

I am working on one application. In my application I have three tabs. In the 3rd tab I have implemented some LinkedIn integration using their SDK, so that user can share on his LinkedIn account wall.

Everything seems to be working fine if I don't use this code inside tabs. But if I integrate the code that uses the LinkedIn SDK inside tabs, then onNewIntent() is not fired.

I am integrating LinkedIn like this:

        Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(liToken.getAuthorizationUrl()));
        i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
        startActivity(i);

It basically opens a web page and when comes back it restarts my previous activity from where i called the LinkedIn SDK, but having no tabs at the bottom.

I want my app to come to my previous activity, and onNewIntent() should be called even when my code is moved inside tabs. How can I achieve it?

Thanks

2条回答
我命由我不由天
2楼-- · 2020-03-04 07:27

I found that onNewIntent will be called as described in documentation if both launchMode="singleTop" and Intent.FLAG_ACTIVITY_SINGLE_TOP are setted.

查看更多
劫难
3楼-- · 2020-03-04 07:44

Set your activitys launchMode="singleTop" in the AndroidManifest.xml instead?

查看更多
登录 后发表回答