-
Notifications
You must be signed in to change notification settings - Fork 1.9k
How to do the MTU negotiation so that MTU size is updated to 128 or more on Android #15790
Comments
I don't think this is an issue with Xamarin.Forms. For more how to questions please turn to other forums like Stack Overflow or Microsoft Q&A, thanks! |
I'm implementing BLE in Xamarin forms using Plugin.BluetoothLE package, where I'm trying to send data larger than 20 bytes. So I used await _Device.RequestMtu(512) but its MTU size is not updating on central device(smartphone device or device inside the app) on Android only '''
} private void IsDevicePairedWatcher() // this method is watching data of hooked characteristic
private async void UpdateMtuSize() //responsible for setting CustomCallback class and requesting Device to request MTU public class AndroidBluetoothLERenderer : IBluetoothManager //rendere setting bluetoothGatt instance
''' I am using PluginBluetoothLE nuget package in xamarin from suggest any alternative to set the MTU size properly |
###Code
'using Android.App;
using Android.Bluetooth;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Plugin.BluetoothLE;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xam.C.Droid;
using Xamarin.Forms;
using Application = Android.App.Application;
[assembly: Dependency(typeof(AndroidBluetoothLERenderer))]
namespace Xam.C.Droid
{
public class AndroidBluetoothLERenderer : IBluetoothManager
{
try
{
bool c;
var adapter = BluetoothAdapter.DefaultAdapter;
}
'
Expected Behavior
Currently on Android device data is truncated to 20bytes and the remaining data will not visible so how to update MTU size negotiation so that it can accept MTU size to 128 butes or more
Actual Behavior
MTU is not correctly setting and also not working on Samsung
Basic Information
Version with issue: Android 9, Android 11, Samusng devices
NuGet Packages:Plugin.BluetoothLE
@jfversluis
@jamesmontemagno
The text was updated successfully, but these errors were encountered: