2

In my app I want to open Google tasks page in WebView. (https://mail.google.com/tasks/android or https://mail.google.com/tasks/canvas (second link most relevant for me, cause I use tablet)).

But when I load url:

wv.loadUrl(url);

My app open native browser and show nested page on it.

Then I tried open page in WebView inside app, with setting custom WebViewClient with

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url){
        view.loadUrl(url);
        return true;
    }

And page opened inside app, but without binding Google account.

Is this possible to open some of this two pages in WebView inside my own app with binding Google acc (auto or not (I have all Google account info)).

UPD

I'm looking for way, how make my WebView authorized in Google, with using AccountManager. I already can generate nested scope (like "ya....").

ps - My app - already authorized in google, and Task Api available.

UPD2

If it's possible I want to manage my authorization status. That mean: I can make my WebView authorized in Google and also unauthorized.

jimpanzer
  • 3,470
  • 4
  • 44
  • 84
  • check my below answer and let me know if you are looking for the same or not. I didnt tried this before but may be it will help you. – Maulik Oct 14 '13 at 11:43
  • I know it's laaaaate, but does answer to this help? http://stackoverflow.com/questions/24451059/login-google-account-in-webview-using-account-manager-token – domen Mar 11 '17 at 11:13

1 Answers1

1

Try below code, Hope you are looking for the same.

check below link:

how to use the Google credentials stored on the device to log in to Google Web sites automatically

another link:

https://developers.google.com/google-apps/tasks/oauth-and-tasks-on-android

but I would not prefer you to use this because of it is deprecated.

EDIT:

Sample code found for the web view

A lot of sites asks the user whether to remember the login state. If the user chooses to remember, the next time the user returns to the site, the site will not require the user to login. This is supported by most web browsers. If you want the WebViewActivity has the same function, you can use CookieSyncManager and CookieManager to do the job. First, when you create your main activity, create a CookieSyncManager with the application context also.

CookieSyncManager.createInstance(getApplicationContext());

Hope it will solve your problem.

Maulik
  • 3,316
  • 20
  • 31
  • Thanks for answer. About "open url in your app" already work code, from my question. The main problem for me now - how to authorize in webview. Unfortunately your link doesn't help me. – jimpanzer Oct 14 '13 at 12:17
  • I also checked new url. The way to create request to google to receive tasks - clear for me. Now I trying open current links in webview. Main problem, that my webview non authorized in google yet, and users must enter thiers login/pass again. I'm looking for solution how create my webview authorized in google with using AccountManager of oauthToken like : "ya-.....". – jimpanzer Oct 14 '13 at 12:57
  • check my edited answer. I have added link of sample code for web view authentication. – Maulik Oct 15 '13 at 12:03
  • thanks for your time. But all what you advise, I tried. The main problem - user MUST enter their login/password. And this is critical for me. I have no idea, why I can't use Account Manager to pass account to -> WebView -> Google. But +1 for your scrupulousness. Thanks – jimpanzer Oct 15 '13 at 12:17
  • welcome, I think it should be any way to do this. let me find it. :) – Maulik Oct 15 '13 at 12:59