0

I m trying google sign in in my android app using webview. in my site its work properly but same page not work in webview

my webpage is : http://docscanner.co.nf/intex.html

and my androidjava code is

    WebView webview = (WebView) findViewById(R.id.wv_main);

    WebSettings webSettings = webview.getSettings();

    webSettings.setJavaScriptEnabled(true);

    webSettings.setBuiltInZoomControls(true);

    webview.requestFocusFromTouch();

    webview.setWebViewClient(new WebViewClient());
    webview.setWebChromeClient(new WebChromeClient());

    webview.loadUrl("http://docscanner.co.nf/intex.html");
Aanal Shah
  • 273
  • 1
  • 2
  • 14

4 Answers4

1

I have checked your URL. It is wrong there is spelling mistake.

URL should be this

http://docscanner.co.nf/index.html

instead of this

http://docscanner.co.nf/intex.html
Bajirao Shinde
  • 1,356
  • 1
  • 18
  • 26
0

Try like this

        WebView webview = (WebView) findViewById(R.id.wv_main);
        webView.setWebViewClient(new WebClient());
        webview.setWebChromeClient(new WebChromeClient());
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.getSettings().setDomStorageEnabled(true);
        webView.setVisibility(View.VISIBLE);
        webView.loadUrl("http://docscanner.co.nf/intex.html");
Saurabh Vardani
  • 1,821
  • 2
  • 18
  • 33
0

Try this:

    webView.setWebViewClient(new MyBrowser());
    String url = "http://docscanner.co.nf/intex.html";
    webView.getSettings().setLoadsImagesAutomatically(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    webView.loadUrl(url);

        private class MyBrowser extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
        view.loadUrl(url);
        return true;
        }
    }
Ashwini Bhat
  • 500
  • 1
  • 4
  • 17
0

Try this code i have check in my emulator and its work well.

public class MainActivity extends AppCompatActivity {
    WebView vishalWeb;
    String Cookies;
    boolean RTFA = false;
    boolean FedAuth = false;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        vishalWeb = (WebView) findViewById(R.id.webview);



        vishalWeb.getSettings().setJavaScriptEnabled(true);
             //   vistaWeb.getSettings().setJavaScriptEnabled(true);



        vishalWeb.setWebViewClient(new MyBrowser());

        vishalWeb.loadUrl("https://accounts.google.com/ServiceLogin?sacu=1&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&hl=en&service=mail#identifier");
        vishalWeb.clearCache(true);


    }

    @Override
    protected void onResume() {
        super.onResume();

    }

    private class MyBrowser extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            view.loadUrl(url);
            Log.i("TAG", "url1=>" + url);

            return true;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

    }
}
Vishal Thakkar
  • 2,117
  • 2
  • 16
  • 33
  • no i don't want to open gmail only, i configure google sign in with my docscanner site and its allow user to sign in with gmail – Aanal Shah Apr 21 '16 at 06:45
  • just replace url with this ==>https://accounts.google.com/ServiceLogin?service=wise&passive=true&continue=http%3A%2F%2Fdrive.google.com%2F%3Futm_source%3Den%26utm_medium%3Dbutton%26utm_campaign%3Dweb%26utm_content%3Dgotodrive%26usp%3Dgtd%26ltmpl%3Ddrive&urp=https%3A%2F%2Fdrive.google.com%2F%3Ftab%3Dgo#identifier – Vishal Thakkar Apr 21 '16 at 06:52
  • @AanalShah so you want to directly upload your docs when user sign in ?? – Vishal Thakkar Apr 21 '16 at 06:54
  • ya i also done its work in website look docscanner.co.nf/index.html – Aanal Shah Apr 21 '16 at 06:55
  • I have on option for this it when you sign in you get cookies and using that you can fire on drive to upload docs – Vishal Thakkar Apr 21 '16 at 06:58
  • @AanalShah you can make web request to upload docs on drive it provide rest api – Vishal Thakkar Apr 21 '16 at 07:07
  • http://www.101apps.co.za/index.php/articles/android-apps-and-google-drive-picking-files.html – Vishal Thakkar Apr 21 '16 at 07:14
  • `04-21 13:40:37.741 23874-23874/synergy.ashah.myapplication I/chromium﹕ [INFO:CONSOLE(6)] "Uncaught TypeError: Cannot read property 'getItem' of null", source: https://ssl.gstatic.com/accounts/o/2172305219-idpiframe.js (6)` give this type of error in logcat – Aanal Shah Apr 21 '16 at 08:11
  • when you get this Error? – Vishal Thakkar Apr 21 '16 at 08:54
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/109774/discussion-between-vishal-halani-and-aanal-shah). – Vishal Thakkar Apr 21 '16 at 08:56