Giter Club home page Giter Club logo

react-native-nordic-dfu's People

Contributors

aluxmanu avatar anees17861 avatar chrischares avatar dariuszseweryn avatar domir avatar ezranbayantemur avatar filipengberg avatar kevinresol avatar looveh avatar manualexsp avatar matheuschn avatar moonbird-yordi avatar niclas-jetset avatar robwalkerco avatar samulitam avatar vikeri avatar yannvanhalewyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-nordic-dfu's Issues

Using with Expo

Hi there!

Thanks for the effort for this package. Trying to make it work with react-native-ble-plx and Expo.

Question: Have you had any experience with using the lib with Expo? One idea would be to have an Expo @config-plugin that could (I suppose) do all the alterations in AppDelegate etc in the prebuild.

React native 0.72.4 targeting android 13 build issues

Hi! 👋

I've recently upgraded react-native version to 0.72.4 and found that android no longer builds due to a couple of issues, you can check both of them on reproducible repo https://github.com/Oleksii27/DfuExample on master branch. To reproduce:

cd android
./gradlew build

And you'll notice couple of build errors

  1. minSdkVersion incompatibility:
> Task :react-native-nordic-dfu:processDebugAndroidTestManifest FAILED
/dev/AwesomeProject/node_modules/react-native-nordic-dfu/android/build/intermediates/tmp/manifest/androidTest/debug/tempFile1ProcessTestManifest8717370557204022401.xml:5:5-74 Error:
        uses-sdk:minSdkVersion 18 cannot be smaller than version 21 declared in library [com.facebook.react:react-android:0.72.4] /Users/.gradle/caches/transforms-3/6fe00d6361b0f0c55549aec89a7f6742/transformed/jetified-react-android-0.72.4-debug/AndroidManifest.xml as the library might be using APIs not available in 18
        Suggestion: use a compatible library with a minSdk of at most 18,
                or increase this project's minSdk version to at least 21,
                or use tools:overrideLibrary="com.facebook.react" to force usage (may lead to runtime failures)

See https://developer.android.com/r/studio-ui/build/manifest-merger for more information about the manifest merger.

Which is caused by minSdkVersion 18 in build.gradle

I've solved it by applying a patch, where I inherited projects minSdkVersion, which I believe is a good solution. I could submit a pull request for that if it's fine.

diff --git a/node_modules/react-native-nordic-dfu/android/build.gradle b/node_modules/react-native-nordic-dfu/android/build.gradle
index 548c19d..6ddc13d 100644
--- a/node_modules/react-native-nordic-dfu/android/build.gradle
+++ b/node_modules/react-native-nordic-dfu/android/build.gradle
@@ -15,13 +15,14 @@ apply plugin: 'com.android.library'
 def DEFAULT_COMPILE_SDK_VERSION = 31
 def DEFAULT_BUILD_TOOLS_VERSION = '31.0.0'
 def DEFAULT_TARGET_SDK_VERSION = 31
+def DEFAULT_MIN_SDK_VERSION = 18
 
 android {
     compileSdkVersion project.hasProperty('compileSdkVersion') ? project.compileSdkVersion : DEFAULT_COMPILE_SDK_VERSION
     buildToolsVersion project.hasProperty('buildToolsVersion') ? project.buildToolsVersion : DEFAULT_BUILD_TOOLS_VERSION
 
     defaultConfig {
-        minSdkVersion 18
+        minSdkVersion project.hasProperty('minSdkVersion') ? project.minSdkVersion : DEFAULT_MIN_SDK_VERSION
         targetSdkVersion project.hasProperty('targetSdkVersion') ? project.targetSdkVersion : DEFAULT_TARGET_SDK_VERSION
         versionCode 1
         versionName "1.0"
  1. The second one is a gradle lint problem which appears after applying the above patch:
> Task :app:lintDebug FAILED
Lint found 1 errors, 5 warnings. First failure:

/dev/AwesomeProject/android/app/src/main/AndroidManifest.xml: Error: When targeting Android 13 or higher, posting a permission requires holding the POST_NOTIFICATIONS permission (usage from no.nordicsemi.android.dfu.DfuBaseService) [NotificationPermission]

   Explanation for issues of type "NotificationPermission":
   When targeting Android 13 and higher, posting permissions requires holding
   the runtime permission android.permission.POST_NOTIFICATIONS.


The full lint text report is located at:
  /dev/AwesomeProject/android/app/build/intermediates/lint_intermediate_text_report/debug/lint-results-debug.txt

FAILURE: Build failed with an exception.

Which is caused by a native no.nordicsemi.android.dfu.DfuBaseService class, I believe it has something to do with DfuBaseService class using some notification posting, but I don't have much experience with java and I haven't really looked at their code. I have found that Android-DFU-Library uses this permission in their AndroidManifest in the example https://github.com/NordicSemiconductor/Android-DFU-Library/blob/b37200033f5d3fe412994e05dd20dd57e14acfe5/app/src/main/AndroidManifest.xml

Which I suppressed by creating a lint config

<?xml version="1.0" encoding="utf-8" ?>
<lint>
    <issue id="NotificationPermission">
        <ignore regexp="no.nordicsemi.android.dfu.DfuBaseService" />
    </issue>
</lint>
lint {
        // https://github.com/bumptech/glide/issues/4940 which I adapted from here
        lintConfig = file("$rootDir/lintConfig.xml")
    }

But as far as I understand this only "suppresses" the error and I don't know about the consequences.

You can check both fixes on a patched branch of an example repo

About upgrade failure?

Hello, if the device is upgraded halfway and Bluetooth is automatically disconnected, causing failure, are there any good optimization items in this area? The nodic app on the official website can search for DfuTarg, and then upgrade it based on the original one.

Add Apple Privacy file

Starting in April 2024, Apple will require a privacy file. Apple - Privacy manifest files

We must declare the Privacy manifest to be able to deploy to the stores, and this file must contain the code not just from the App but any third-party library we install in our App.

It will be beneficial if we have the Privacy Manifest file in the repo or documentation 🙏

Is this something on the radar? I saw the library install the OpenSSL SDK, which Apple lists in the SDK that requires the privacy file declared.

Trouble reading firmware file

I am experiencing issues reading the firmware files on both IOS and Android. After using RNFS to move the ZIP file, it seems to become totally corrupted on Android (I can't find the file to check it on IOS) (This seems more like an issue with RNFS than this library to me, but I wasn't able to find help there, so I hoped one of you may have encountered it over here and have a solution) and without RNFS, Android has issues reading the manifest file and IOS gives the same error (Error: Firmware not specified) regardless of if I use RNFS.

I will get screenshots and exact errors for all of these cases, but I wanted to put this up here first incase anyone has encountered the same problem and found a solution.

I am running RN 72.6 without expo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.