'How can enable HotSpot on android device by delphi code
By this delphi code I can enable wifi on android device.
    var    WiFIServiceNative: JWifiManager;
    
    begin
     WiFIServiceNative := 
      JWifiManager.Wrap(TAndroidHelper.Context.getSystemService(TJContext.JavaClass.WIFI_SERVICE));
     if Assigned(WiFIServiceNative) then
      TJWifiManager.JavaClass.WIFI_STATE_ENABLED
    end;
How can enable hotspot by delphi code.
Solution 1:[1]
I'm also trying to enable hotspots from code with delphi. for the moment if you need this is the code to open the related menu.
  procedure TForm1.Button1Click(Sender: TObject);
var
Intent : JIntent;
NativeComponent : JComponentName;
PackageName:Jstring;
AppName:JString;
begin
PackageName:=StringToJString('com.android.settings');
AppName:=StringToJString('com.android.settings.TetherSettings');
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_MAIN);
Intent.addCategory(TJIntent.JavaClass.CATEGORY_LAUNCHER);
NativeComponent := TJComponentName.JavaClass.init(PackageName, AppName);
Intent.addFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK or TJIntent.JavaClass.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
Intent.setComponent(NativeComponent);
Intent.setFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK) ;
SharedActivity.startActivity(Intent);
end;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | Fantasens | 
