Android Browser Callbacks and Madness Stack

I'm struggling to get specific behavior for OAuth authorization using the ubiquitous callback using a special scheme -> the aim_filter method.

My application registers for SEND actions and, when called, start the service, which, in turn, checks whether the user is already authorized and, if not, generates an activity (OAuthActivity) to request a login.

Keep in mind that there can be any front activity right before that. Then the action launches the VIEW intention to open the authorization page in the browser; the latter calls the processed callback (with the user schema defined in the manifest) and wakes up OAuthActivity.

OAuthActivity currently has launchMode="singleTask" , but this has nothing to do with the perspectives of the stack (it comes back from the top when called).

Is there a way to clear the activity stack and return to what the user is doing, rather than getting him to click back on browser activity? (Then I will show a notification when the content was successfully sent in the background)

Does anyone have pointers? Thanks for reading

+6
source share
1 answer

Then the activity launches the VIEW target to open the authorization page in the browser.

This is problem. This works for me: make the oauth webpage in a web browser that you control and not run in a browser application.

The oauth webpage, when it calls the callback, will actually replace itself in the webview, where your WebViewClient can catch the expected URL, process the results and complete () the webview (remove it from the activity stack),

+1
source

Source: https://habr.com/ru/post/906795/


All Articles