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

Remove dependency on androidx.localbroadcastmanager. Re-enable Maven Central publishing #1022

Merged
merged 9 commits into from
Apr 14, 2021

Conversation

davidgyoung
Copy link
Member

This removes all code that uses the deprecated class androidx.localbroadcastmanager.content.LocalBroadcastManager which had been removed from the Android 11 SDK. The continued use of this class had added the painful need to add an extra dependency on androidx.localbroadcastmanager in the build.gradle of any project using this library. That extra dependency is no longer needed.

Two functional areas changed as a result of not having access to LocalBroadcastManager:

  1. Delivery of ranging and monitoring data from the ScanJob to the client application used to use this construct, but now uses direct method calls using a singleton that brokers the communication.
  2. Delivery of BluetoothMedic events to the BluetoothMedic for processing and potential bluetooth power cycling. Again, this construct has been replaced by direct method calls to the BluetoothMedic singleton.

There are no known drawbacks to the above refactoring, although if client applications had gone around the public APIs and relied on the internal (private) library implementation of local broadcasts, this will no longer work.

Separately, this change completely rewrites the build scripts to once again enable publishing to Maven Central (since JCenter is going away) and in the process use the latest Gradle and Android SDKs and tools.

The code from this PR is available on Maven Central as release 2.18-beta. To use it:

  1. Modify your outermost build.gradle to add back in mavenCentral:
repositories {
       google()
       jcenter()
       mavenCentral()
   } 
  1. Change your project build.gradle files to use the beta library:
     implementation 'org.altbeacon:android-beacon-library:2.18-beta'
  1. Remove the localbroadcastmanager dependency:
    // Needed for legacy LocalBroadcastManager used by the library prior to library version 2.18
    //implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'

@davidgyoung davidgyoung merged commit c659c77 into master Apr 14, 2021
@davidgyoung
Copy link
Member Author

@EKliptus I believe this is possible and plan to make this change in the next release #1023

@EKliptus
Copy link

@davidgyoung Thanks a lot !

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

Successfully merging this pull request may close these issues.

2 participants