I have developed a site, you can search and download youtube videos. In order to adapt it to mobile, I made a Webview from android studio and some problems arose as follows: 1 - The photos I took are not listed when searching enter image description here
While this is the case on the site, what is happening in application is:
I can't understand why this is happening. When I add the video iframe, they appear smoothly, but the photos are not in the application, I am not sure how to solve it, I would appreciate it if you could help.
2 - Due to the source I use while downloading something (loader.to/api/button/), when I click the download button, the ad comes, sends it to another site, and when it returns to the previous location, it is reset and the download process is reset and it is necessary to start the download process again, which causes the advertisement to come again. it's always on the same loop. I'm not sure how effective it is for this, but I came up with a solution, I thought to ban extensions outside of my site in Java, so if it is redirected to a place other than my site and its extension, it will prevent it. But I couldn't find how to do this(like i said im not sure this is the solution if you have another solution you can say that). If I explain with photos, it's like this:enter image description here
I start the download here, then after I click the download button, the ad comes up. enter image description here and then i come back here with reseted(in website at this state download option is coming but here it is back to top)
enter image description here Can you help with how I can do this or if you have any other solution ideas? here is my java code:
package com.example.save2b;
import android.graphics.Bitmap;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends AppCompatActivity {
private WebView mywebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mywebView=(WebView) findViewById(R.id.webview);
mywebView.setWebViewClient(new WebViewClient());
mywebView.loadUrl("mysite.com");
WebSettings webSettings=mywebView.getSettings();
webSettings.setJavaScriptEnabled(true);
}
public class mywebClient extends WebViewClient {
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view,url,favicon);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
@Override
public void onBackPressed() {
if (mywebView.canGoBack()) {
mywebView.goBack();
} else {
super.onBackPressed();
}
}
}