• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

android web view problem on loading site data

dherst_4

Lurker
hello

I wrote a web viewing application

But the problem here is with internal content like file uploads, likes, comments and ...Can not access

But in the Chrome browser I open, I can do all this

Can anyone help me on this?

Even in webviewing software there is a problem
 
Moved to Android Development forum.

You problem isn't clearly defined. Could you clarify, and add some relevant code to demonstrate the problem?
 
Moved to Android Development forum.

You problem isn't clearly defined. Could you clarify, and add some relevant code to demonstrate the problem?

i don't any problem in coding
just For example, I open my site with a browser, similar to Chrome.
I can browse and send post on the site



. But in webview app, I can not access the site's internal content, such as uploading or ...
 
Considering you did not post any code to analyze to find the issue I'll simply just post some code from one of my old apps. Maybe this will help you, maybe it won't.

Code:
private WebView webview;
    String url = "https://SOME-URL.com/";
    ProgressBar progress;

    @Override
    @SuppressWarnings("setJavaScriptEnabled")
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web);

        Toolbar toolbar = findViewById(R.id.mytoolbar);
        toolbar.setTitleTextAppearance(this, R.style.toolbarText);
        setSupportActionBar(toolbar);
        if(getSupportActionBar() != null){
            getSupportActionBar().setElevation(4);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }

        progress = findViewById(R.id.progressBar);
        progress.setVisibility(View.GONE);

        webview = findViewById(R.id.webView);
        webview.getSettings().setJavaScriptEnabled(true);
        webview.getSettings().setBuiltInZoomControls(true);
        webview.getSettings().setDisplayZoomControls(false);
        webview.getSettings().setLoadWithOverviewMode(true);
        webview.getSettings().setUseWideViewPort(true);
        webview.setWebViewClient(new MyWebViewClient());
        webview.loadUrl(url);

        webview.setDownloadListener(new DownloadListener() {
            public void onDownloadStart(String url,
                                        String userAgent,
                                        String contentDisposition,
                                        String mimetype,
                                        long contentLength) {
                String fileName = URLUtil.guessFileName(url, contentDisposition, mimetype);
                String cookie = CookieManager.getInstance().getCookie(url);

                DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
                DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
                request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE);
                request.setAllowedOverRoaming(false);
                request.allowScanningByMediaScanner();
                request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
                request.addRequestHeader("Cookie", cookie);
                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
                if (dm != null) {
                    dm.enqueue(request);
                }

            }
        });

    }

    private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            return super.shouldOverrideUrlLoading(view, url);
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progress.setVisibility(View.VISIBLE);
            Stylo.this.progress.setProgress(0);
            super.onPageStarted(view, url, favicon);
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            progress.setVisibility(View.GONE);
            Stylo.this.progress.setProgress(100);
            super.onPageFinished(view, url);
        }

    }

    @Override
    public void onBackPressed() {
        if(webview.canGoBack()) {
            webview.goBack();
        } else {
            super.onBackPressed();
        }
    }
 
i don't any problem in coding
just For example, I open my site with a browser, similar to Chrome.
I can browse and send post on the site



. But in webview app, I can not access the site's internal content, such as uploading or ...

What do you mean by "webview app"? Is this your app?
Webview is a UI component provided by the Android SDK, as demonstrated above by @GameTheory . What do you think Webview means?
 
But the problem here is with internal content like file uploads, likes, comments and ...Can not access

I think you need to expand on this. Is it a server problem? Are you getting an exception in your app?
 
my first problem is not installing app
AndroidManifest.xml
Please fix this problem so I will send you an example of your main problem


Java:
<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:installLocation="auto"
    package="ir.picsgram.usershots">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CAMERA" />

    <application
        android:name=".WebViewAppApplication"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.WebViewApp.Gray"
        android:hardwareAccelerated="true"
        android:allowBackup="true"
        android:supportsRtl="true"
        android:usesCleartextTraffic="true"
        tools:ignore="AllowBackup,UnusedAttribute">

        <activity
            android:name=".activity.MainActivity"
            android:label="@string/app_name"
            android:launchMode="standard"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" />
                <data android:host="@string/app_deep_link_host" />
                <data android:pathPrefix="@string/app_deep_link_path" />
            </intent-filter>
        </activity>

    </application>
</manifest>
 
my first problem is not installing app

When you say "not installing", what's the problem? Do you get an error? What happens when you try to install it directly from Android Studio?
What error is in the Logcat?
 
Android Studio has no problem getting it out.

i only have trouble installing the app on mobile
And the installation time does not install

When you say "not installing", what's the problem? Do you get an error? What happens when you try to install it directly from Android Studio?
What error is in the Logcat?
 
Back
Top Bottom