我为 Android 应用程序实现了一个 Web 服务.Web 服务在我的本地主机 (192.168.1.2) 上运行.使用 Android 模拟器,我成功连接到 Web 服务.我尝试使用调试模式将我的 Android 设备连接到 Web 服务,但没有成功.所以我的问题是,是否可以在不使用真实 IP 的情况下将 Android 设备连接到在我的本地主机(192.168.1.2)上运行的这个 Web 服务?
I implemented a web service for an Android application. The web service is running on my local host (192.168.1.2). Using the Android emulator I succeeded to connect to web service. The I tried to connect my Android device using debugging mode to web service but it didn't work. So my question is if it is possible to connect an Android device to this web service that is running on my local host (192.168.1.2) without using a real IP ?
chrome://inspect/#deviceslocalhost:61437 上有服务,我只是将它链接到设备的 8081 端口.记得勾选启用端口转发"复选框chrome://inspect/#devices
localhost:61437 and I just linked it to device's 8081 port. Remeber to check 'Enable port forwarding' checkbox我电脑上的服务屏幕 (localhost:61437)
使用相同服务 (localhost:8081) 的移动浏览器屏幕.就是这样.您也在您的应用程序中使用此服务地址
screen from my mobile browser with the same service ( localhost:8081). And that's it. Also you use this service address in your application
这篇关于将 Android 设备连接到本地主机上的 Web 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
使用 GPS 获取用户的当前位置Get user#39;s current location using GPS(使用 GPS 获取用户的当前位置)
requestLocationUpdate() 抛出的 IllegalArgumentExceptionIllegalArgumentException thrown by requestLocationUpdate()(requestLocationUpdate() 抛出的 IllegalArgumentException)
LocationManager 的 getLastKnownLocation 有多可靠,多久更How reliable is LocationManager#39;s getLastKnownLocation and how often is it updated?(LocationManager 的 getLastKnownLocation 有多可靠,多久更新
如何检测位置提供者?GPS 或网络提供商How to detect Location Provider ? GPS or Network Provider(如何检测位置提供者?GPS 或网络提供商)
在应用启动期间获取当前位置Get current location during app launch(在应用启动期间获取当前位置)
locationManager.getLastKnownLocation() 返回 nulllocationManager.getLastKnownLocation() return null(locationManager.getLastKnownLocation() 返回 null)