Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 12 Support #41

Open
Montvydas opened this issue Jan 8, 2022 · 5 comments
Open

Android 12 Support #41

Montvydas opened this issue Jan 8, 2022 · 5 comments

Comments

@Montvydas
Copy link

As discussed in the Android-DFU-Library github page issue 315, there was an issue with the library on Android 12, which by now is fixed and the fix is released. This flutter library does not have the fix and thus it cannot be used on Android 12. The required changes are minimal, only needing to update the Flutter library with the new releases from the Nordic Semiconductors.

@Montvydas
Copy link
Author

Montvydas commented Jan 9, 2022

Just to let you know, I have managed to do this myself here, since it only required changing file android/build.gradle, I updated to version 1.12.1-beta01 since that was the latest one and I no longer get the mentioned error. This however adds some other issues. Firstly, it changes the way, how within Android one requests permissions as starting Android 12 if one requests Bluetooth permission, it will be rejected automatically, instead one needs to specifically ask for bluetoothScan, bluetoothConn and bluetoothAdvertise permissions e.g. using the permissions permission_handler library one could request these permissions:

  final kPermissions = const <Permission>[
    Permission.bluetoothScan,
    Permission.bluetoothConnect,
    Permission.bluetoothAdvertise,
    Permission.locationWhenInUse,
  ];

Manifest will also have to change as explained here and it seems that the permission handling will need to check wether the android version is below 12 or above 12.

There is still some sort of unknown issue: I manage to start DFU uploading and it gets to the point of printing "Uploading firmware...", followed by uploading the firmware all the way until 100% (know this from using the DefaultDfuProgressListenerAdapter) and then nothing happens, startDfu method basically never exits. I tried waiting like 10min but the app simply gets blocked there and if I cancel the DFU upload at this point the board is bricked and required flashing the firmware using a cable. Has anyone experienced this before?

@GoodOldBatman
Copy link

Thanks for pointing out that one can simply replace the Android Dfu Library! They recently updated to 2.0.2. Together with your other suggestions, I could get it to work with Android 12 (Pixel 4).

I have not experienced that the DFU got stuck after 100 % and the device getting bricked.

@Montvydas
Copy link
Author

Montvydas commented Apr 7, 2022

So the device being bricked is the issue of single bank approach, where the old firmware is deleted before downloading the new one. With dual bank setup this shouldn't happen.. Yet I would still have the issue of unsuccessful update.

Edit: I haven't tried the new version 2.0.2, since at the time the latest was 1.12.1-beta01, so potentially the problem was within the Nordic SDK itself, I will update this issue after trying out the latest version some time later.

@Montvydas
Copy link
Author

Ok, so I tried using 2.0.2 however still had the same problem. I also tried nordic-dfu library (since it seems that flutter-nordic-dfu is no longer mainated) and experienced the same problem. There is an issue raised already which outlines the same problem I am having here :/

@haoyuant
Copy link

haoyuant commented Jun 1, 2022

Any update on the new release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants