Parental control on Android

0

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)); }
    
asked by Nelson Redondo Barros 26.03.2018 в 16:09
source

1 answer

0

I was able to solve the problem with the tabs using this method

private void startBrowsergoogle(String url) {
    Browser browser = Browser.browsers.get(1);
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(1082130436);
    intent.addFlags(-4194305);
    intent.setDataAndType(Uri.parse(url), "text/html");
    intent.setComponent(new ComponentName(browser.getPackage(), browser.getActivity()));
    intent.putExtra("com.android.browser.application_id", browser.getPackage());

    startActivity(intent);
}

so do not know what is addflags, when you use it, setFlags are replacing old flags ... when you use addFlags, you add new flags. Remember, a flag is only an integer that is a power of two ... in binary, the flags look like this: 1, 10, 100, 1000, etc. ... (which in this case are 1, 2, 4, 8). So, what addFlags means add the whole number that happens with the | operator?

// example ... // value of flags: 1 intent.setFlags (2 | 4); // now the flags have this value: 110 intent.addFlags (8); // now the flags have this value: 1110

    
answered by 03.04.2018 / 22:42
source