我需要在Android 2.2(Froyo)中创建一个API调用来创建一个Wifi热点(如Tethering和Portable Hotspot设置项中所示).
Android最近在其SDK源代码中引入了@SystemApi.看起来像之前的@hide注释一样有效,因为它们也被从SDK jar类中剥离.
应用程序是否有可能以与旧的@hide API不同的方式调用它们.
/**
* Indicates an API is exposed for use by bundled system applications.
* <p>
* These APIs are not guaranteed to remain consistent release-to-release,
* and are not for use by apps linking against the Android SDK.
* </p><p>
* This annotation should only appear on API that is already marked <pre>@hide</pre>.
* </p>
*
* @hide
*/
Run Code Online (Sandbox Code Playgroud) 我想知道如何检测WiFi网络共享的状态.我看过一篇文章:Android 2.3 wifi热点API但它不起作用!它总是返回WIFI_AP_STATE_DISABLED = 1.它不依赖于WiFi网络共享的真实状态.
嘿伙计们,每当我尝试在我的手机或模拟器上打开应用程序时,我会在我的Log cat中收到此错误.为了概述我目前正在进行的项目,它是一个记录连接到手机上接入点的设备数据的系统,可以通过屏幕上的按钮打开和关闭.
我想赞扬:
和
2)https://www.whitebyte.info/android/android-wifi-hotspot-manager-class
Log cat文件的图像是:https: //i.gyazo.com/fa068fd1fce3f27f43185c0cd12568c1.png
我的主要活动课
public class MainActivity extends ActionBarActivity{
boolean wasApEnabled = false;
static AccessPoint wifiAP;
private WifiManager wifi;
static Button apButton;
static TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
apButton = (Button) findViewById(R.id.toggleBtn);
textView = (TextView) findViewById(R.id.wifiClients);
wifiAP = new AccessPoint();
wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
scan();
apButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
wifiAP.toggleWifiAP(wifi, MainActivity.this);
}
});
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|WindowManager.LayoutParams.FLAG_DIM_BEHIND);
}
private void scan(){
wifiAP.getClientList(false, …Run Code Online (Sandbox Code Playgroud)