我正在使用以下两种api级别的方法< 26但是对于Api水平> 26它给出了错误,有人可以帮助如何修复下面的块。
提前致谢。
//activate mobile connection in addition to other connection already activated
try{
int resultInt = connectivityManager.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, "enableHIPRI");
Log.e(TAG, "startUsingNetworkFeature for enableHIPRI result: " + resultInt);
if (-1 == resultInt) {
Log.e(TAG, "Wrong result of startUsingNetworkFeature, maybe problems");
return false;
}
if (0 == resultInt) {
Log.e(TAG, "No need to perform additional network settings");
return true;
}
if (2 == resultInt) {
Log.e(TAG, "Device specific state unknown.");
return false;
}
}catch (Exception e){
e.printStackTrace();
return false;
}
boolean resultBool = connectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_HIPRI, hostAddress);
Log.e(TAG, "************requestRouteToHost result***********" + resultBool);
if (!resultBool)
Log.e(TAG, "Wrong requestRouteToHost result: expected true, but was false");
return resultBool;