位置: 编程技术 - 正文

Android检测网络信号强弱(android检测网络差)

编辑:rootadmin

推荐整理分享Android检测网络信号强弱(android检测网络差),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:android检测网络是否稳定,安卓手机测试网络状况,android检测网络是否稳定,android检测网络是否可用,android 检测网络,android检测网络是否可用,android检测网络是否稳定,android检测网络差,内容如对您有帮助,希望把文章链接给更多的朋友!

转载自: view plaincopy<LinearLayout xmlns:android=" xmlns:tools=" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <!-- <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@android:color/white" /> --> <TextView android:id="@&#;id/textView1" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:textColor="@android:color/black" android:textSize="sp" /> </LinearLayout> Android检测网络信号强弱(android检测网络差)

AndroidMenifest.xml中,加入两行,作用:获取权限

[html] view plaincopy<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>

最后是MainActivity.java中的程序:[java] view plaincopypackage com.example.wifistrength; import java.util.List; import android.net.wifi.ScanResult; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.view.Menu; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { TextView tv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String wserviceName = Context.WIFI_SERVICE; WifiManager wm = (WifiManager) getSystemService(wserviceName); WifiInfo info = wm.getConnectionInfo(); int strength = info.getRssi(); int speed = info.getLinkSpeed(); String units = WifiInfo.LINK_SPEED_UNITS; String ssid = info.getSSID(); tv = (TextView) findViewById(R.id.textView1); List<ScanResult> results = wm.getScanResults(); String otherwifi = "The existing network is: nn"; for (ScanResult result : results) { otherwifi &#;= result.SSID &#; ":" &#; result.level &#; "n"; } String text = "We are connecting to " &#; ssid &#; " at " &#; String.valueOf(speed) &#; " " &#; String.valueOf(units) &#; ". Strength : " &#; strength; otherwifi &#;= "nn"; otherwifi &#;= text; tv.setText(otherwifi); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } } 结果图:

Unity3D如何导入网上下载的unityPackage 导入Unity3D的unityPackage包你把下载来的包放到你Unity的安装目录:EditorStandardPackages里面,即可。另外从assetstore下载的包,放在了:C:UsersAdministratorAppDat

Unity3D之各个平台的path 转载自:

Unity3D之NGUI的优化 转载自:

本文链接地址:https://www.jiuchutong.com/biancheng/378774.html 转载请保留说明!

上一篇:Unity3D中与Android通信(unity与android交互详细)

下一篇:Unity3D如何导入网上下载的unityPackage(unity3d如何导入图片)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络