significado - sms android developer
startUsingNetworkFeature y requestRouteToHost Depreciated en 6.0 alternativa a esto (1)
Tengo el problema a continuación funciona bien, simplemente me olvido de turn on mobile data.
NetworkRequest.Builder builder = new NetworkRequest.Builder();
builder.addCapability(NetworkCapabilities.NET_CAPABILITY_MMS);
builder.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
NetworkRequest networkRequest = builder.build();
mConnMgr.requestNetwork(networkRequest, new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
dialog.dismiss();
sendNormalMms();
}
});
El dispositivo listo para enviar mms funciona bien en Kitkat, pero la versión Pro KitKat startUsingNetworkFeature se deprecia.
final int result = mConnMgr.startUsingNetworkFeature(
ConnectivityManager.TYPE_MOBILE, "enableMMS");
final ProgressDialog dialog =
ProgressDialog.show(mContext, "", getString(R.string.compose_thread_dailog_converting_multi));
if (result != 0) {
IntentFilter filter = new IntentFilter();
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
Log.i("recived", "action");
if (!action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
return;
}
NetworkInfo mNetworkInfo = (NetworkInfo) intent
.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
if ((mNetworkInfo == null)
|| (mNetworkInfo.getType() != ConnectivityManager.TYPE_MOBILE_MMS)) {
return;
}
if (!mNetworkInfo.isConnected()) {
return;
} else {
Log.i("recived", "OK mms features");
context.unregisterReceiver(receiver);
dialog.dismiss();
sendNormalMms();
}
}
};
context.registerReceiver(receiver, filter);
} else {
// sendData(recipient, SentMMS);
Log.i("recived", "OK mms features");
// context.unregisterReceiver(receiver);
dialog.dismiss();
sendNormalMms();
}
}
¿Cómo puedo lograr esta función en 6.0 intenté esto? Tengo la característica mms del dispositivo móvil pero ¿cómo puedo usar esta función requestRouteToHost
NetworkRequest.Builder builder = new NetworkRequest.Builder();
// builder.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET);
builder.addCapability(NetworkCapabilities.NET_CAPABILITY_MMS);
builder.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR);
NetworkRequest networkRequest = builder.build();
mConnMgr.requestNetwork(networkRequest, new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
super.onAvailable(network);
dialog.dismiss();
sendNormalMms();
}
});
Se necesita la implementación requestRouteToHost para 6.0?