Forum Documentation Showcase Pricing Learn more

Custom code via plugins... is it possible?


#1

Hi there guys,

I’m trying to get my head wrap around the platform.

I need to implement something like the following…

package com.BrowserSettings;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.provider.Settings;

public class BrowserSettingsUI extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        final Button button = (Button) findViewById(R.id.Button01);
        button.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                try {
                    Settings.System.putString(getContentResolver(),  
            Settings.System.HTTP_PROXY, "127.0.0.1:100");//enable proxy
                }catch (Exception ex){
                }
            }
        });

        final Button button2 = (Button) findViewById(R.id.Button02);
        button2.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View v) {
                try {
                    Settings.System.putString(getContentResolver(), 
            Settings.System.HTTP_PROXY, "");//disable proxy
                }catch (Exception ex){
                }
            }
        });
    }
}

You must add

<uses-permission android:name=”android.permission.WRITE_SETTINGS” />

Is this even possible using plugins or is there different way. My app needs to be able to enforce the proxy for the device at all time.

Please let me know.


#2

FYI, I know that the code is in Java and not JS. I just need to know if anyone has done this level of customization.


#3

Check out the Toolkit here - https://bubble.is/plugin/toolbox-1488796042609x768734193128308700

This lets you inject custom JS.