In my Android 11 TvBox rooted, I prepared an action in Macrodroid, in order to connect to a not saved WiFI SSID, using Javascript.
This Javascripot was written by ChatGPT, since I am not proficient at all in this language:
When I test the action with Jetpack Javascript, I receive the following error from the Macrodroid Log: "This device does not support the Jetpack Javascript Engine"
Using quickJs instead I get: "java.lang,NoClassDefFoundError:com.hippo.quickjs.android.QuickJS".
Finally, using JSEvaluator I get...nothing.
I don't really know what I am doing.
Any help would be appreciated.
Thanks
This Javascripot was written by ChatGPT, since I am not proficient at all in this language:
List<String> wifiList = WifiManagerCompat.getScanResults(context);
CharSequence[] wifiArray = wifiList.toArray(new CharSequence[wifiList.size()]);
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Choose a Wi-Fi network");
builder.setItems(wifiArray, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Connect to the selected Wi-Fi network
String selectedWifi = wifiList.get(which);
// Create a dialog for entering the password
EditText passwordInput = new EditText(context);
passwordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
AlertDialog.Builder passwordDialogBuilder = new AlertDialog.Builder(context);
passwordDialogBuilder.setTitle("Enter Wi-Fi Password");
passwordDialogBuilder.setView(passwordInput);
passwordDialogBuilder.setPositiveButton("Connect", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Get the entered password
String password = passwordInput.getText().toString();
// Connect to the selected Wi-Fi network with the password
boolean isConnected = WifiManagerCompat.connectToWifi(context, selectedWifi, password);
// Display connection status
String message = isConnected ? "Connected to " + selectedWifi : "Failed to connect to " + selectedWifi;
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}
});
passwordDialogBuilder.setNegativeButton("Cancel", null);
passwordDialogBuilder.show();
}
});
builder.show();
When I test the action with Jetpack Javascript, I receive the following error from the Macrodroid Log: "This device does not support the Jetpack Javascript Engine"
Using quickJs instead I get: "java.lang,NoClassDefFoundError:com.hippo.quickjs.android.QuickJS".
Finally, using JSEvaluator I get...nothing.
I don't really know what I am doing.
Any help would be appreciated.
Thanks