package com.insuite.technicien; import android.content.Intent; import android.provider.Settings; import com.getcapacitor.JSObject; import com.getcapacitor.Plugin; import com.getcapacitor.PluginCall; import com.getcapacitor.PluginMethod; import com.getcapacitor.annotation.CapacitorPlugin; @CapacitorPlugin(name = "KioskSettings") public class KioskSettingsPlugin extends Plugin { @PluginMethod public void openWifiSettings(PluginCall call) { openSettings(call, Settings.ACTION_WIFI_SETTINGS); } @PluginMethod public void openNetworkSettings(PluginCall call) { openSettings(call, Settings.ACTION_WIRELESS_SETTINGS); } @PluginMethod public void openDeviceSettings(PluginCall call) { openSettings(call, Settings.ACTION_SETTINGS); } private void openSettings(PluginCall call, String action) { try { Intent intent = new Intent(action); intent.setPackage("com.android.settings"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getContext().startActivity(intent); JSObject result = new JSObject(); result.put("ok", true); call.resolve(result); } catch (Exception exception) { call.reject("settings_open_failed", exception); } } }