My project is a parental control that filters explicit content (pornography) and implementation of secure search in search engines. I already have the methods for such actions but I have found that at the time of navigation in any mobile browser the result is displayed in a new tab and the goal is to replace the content of that tab by the blocking page or by the result of the secure search.
The problem is that the result is creating it in a new tab and the objective is to update the content of that tab, or otherwise, it would close the tab and open a new one with the desired result
This is the method for filtering and safe search on Android.
Filtro web;
public void leena_primerf(final String url1)
{
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
url = "http://peerfy.co/api2/index.php?url=" + url1;
StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
new Response.Listener<String>() {
//@SuppressLint("SetTextI18n")
@Override
public void onResponse(String response) {
// Log.d("cual es la url", "el estado es : " + response + url1);
try {
JSONObject jsonObject = new JSONObject(response);
String estado = jsonObject.getString("status");
int loco = Integer.parseInt(estado);
if (loco>0)
{
String urlco= url_codificada(url1);
// String urlString=("http://peerfy.co/bloqueoandroid/index.php?pk="+urlco);
String urlString=("http://localhost:5358/"+urlco);
Intent intent=new Intent(Intent.ACTION_VIEW,Uri.parse(urlString));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage(Paquetefirefox);
startActivity(intent);
}
}
catch (Exception ex) {
Log.d("problemas", "el estado es : " + ex);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
queue.add(stringRequest);
}
Búsqueda segura;
public void Safesearchg(String urlgoogle){
String urlString=(urlgoogle.concat("&safe=strict"));
Intent sharingIntentg = new Intent(Intent.ACTION_VIEW);
sharingIntentg.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
sharingIntentg.setData(Uri.parse(urlString));
sharingIntentg.setPackage(Paquetechrome);
Intent chooserIntentg = Intent.createChooser(sharingIntentg, "Open With");chooserIntentg.setPackage(Paquetechrome);startActivity(Intent.createChooser(sharingIntentg, "Open With").setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); }