本文介绍了如何WiFi和移动数据无论是在机器人同时工作的OBD2设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的应用程序,连接OBD2设备通过WiFi和应用程序可以在android.So wifi的读取速度,转速,发动机冷却液温度等细节仅用于与OBD2设备连接(它没有工厂与连接上网,只为沟通)和it.Now沟通,我需要的Web服务。但我连无线后,我无法通过我的移动数据网络中的机器人连接互联网的网络连接。

类似的应用也发展为iOS。现在在iOS中,我可以通过无线(静态无线设置),并从我的蜂窝网络的互联网连接使用的应用程序。这意味着配置我的无线网络的一些静态IP,我能够使用移动数据网络的Internet连接iOS中。

但在Android的,如果我使用静态WiFi和检查互联网连接,这是不可用的。

我如何使用WIFI和互联网连接两者平行,或者在安卓配置WiFi设置任何其他方式?任何帮助将是AP preciated。

解决方案

  connectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI,hostAddress);
 

您可以要求一定hostAddress,它必须使用这种类型的连接。如果你使用Hipri那么它会移动网络。但是,这可能会失败!如果成功,那么所有连接到该地址会在该类型的连接。

您可能必须先激活它。

  INT resultInt = connectivityManager.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,enableHIPRI);
 

这可能需要几秒钟,因为硬件模块已经启动。

我已经使用了几个项目和伟大工程。在旧的设备,如2.2将反应真的很不稳定!但是我还没有发现任何问题,在4.0 +

I'm developing application which connect OBD2 device by Wifi and app can read Speed,RPM,Engine coolant temperature details etc in android.So wifi is used only for connecting with OBD2 device(it doesn't have facility to connect with internet,only for communicating) and communicate with it.Now I need internet connection for web services.But after connecting my wifi I am not able to connect internet via my mobile data network in android.

The similar application is also developed for iOS. Now in iOS, I can use application by Wifi (Static Wifi setting) and Internet connection from my cellular network. It means configure my wifi with some static ip I am able to use mobile data network for Internet connection in iOS.

But in Android, If I use static wifi and check for Internet connection, it is not available.

How can I use Wifi and Internet connection both run parallel or any other way by configuring wifi settings in android ?Any help would be appreciated.

解决方案
connectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI, hostAddress);

You can request for a certain hostAddress that it must use that type of connectivity.IF you use Hipri then it will take the mobile network.But this can fail ! If it works, then ALL connections to that address will go over that type of connectivity.

You might have to activate it first.

int resultInt = connectivityManager.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, "enableHIPRI");

This can take a couple of seconds, since the hardware modules has to start up.

I've use this on several projects and works great.On old device such as 2.2 it will react really unstable !But I haven't found any problems on 4.0+

这篇关于如何WiFi和移动数据无论是在机器人同时工作的OBD2设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 04:30