简体   繁体   English

如何通过 delphi 代码在 android 设备上启用 HotSpot

[英]How can enable HotSpot on android device by delphi code

By this delphi code I can enable wifi on android device.通过这个 delphi 代码,我可以在 android 设备上启用 wifi。

    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.如何通过 delphi 代码启用热点。

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.我也在尝试通过 delphi 的代码启用热点。目前,如果您需要,这是打开相关菜单的代码。

  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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Delphi中以编程方式在android设备上启用wi-fi? - How to programmatically enable wi-fi on android device in Delphi? 如何以编程方式启用 Android O WiFi 热点 - How to enable Android O WiFi Hotspot programmatically 如何在Android虚拟设备中创建热点? - How to create Hotspot in Android Virtual Device? Android上的两个设备热点 - Two device hotspot on android 在Android中如何查看设备是否支持HS2.0(Hotspot 2.0)或Passpoint Configuration? - How can we check whether the device support HS2.0(Hotspot 2.0) or Passpoint Configuration in Android? 如何在marshmallow和Android版本以编程方式启用移动热点? - How to enable mobile hotspot programmatically in marshmallow and above android version? 我可以使用python打开android设备的热点吗 - Can I turn on the hotspot of an android device using python 如何在 Android 上以编程方式启用/禁用热点或网络共享模式? - How do I enable/disable hotspot or tethering mode programmatically on Android? 如何使用代码以编程方式在 android 设备中启用浮动通知 - how to programmatically enable floating notification in android device using code 如何知道Android设备是否已连接到公共wifi热点 - How to know if an Android device is connected to a public wifi hotspot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM