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

Adding notification channel to support devices with Android 8.0 and above #943

Merged
merged 1 commit into from
Jan 26, 2020

Conversation

anuvakkachen
Copy link
Contributor

@anuvakkachen anuvakkachen commented Jan 11, 2020

This PR adds a notification channel to be used in notifications posted by BluetoothMedic.
Posting notifications without a channel does not work on Android 8.0 and above

Expected Behavior:
When BluetoothMedic is used for power cycling bluetooth, on scan failures, and Medic notifications are enabled, when a scan failure occurs , bluetooth is power cycled and a notification is posted that says so.

Actual Behavior:
Bluetooth is power cycled, but no notification is posted.
If Settings> developer options > Show Notification channel warnings is turned on, a warning toast message can be seen, .

Steps to reproduce:

  1. Use the android beacon library reference app and enable BluetoothMedic power cycling and notifications in RangingActivity

    BluetoothMedic.getInstance().enablePowerCycleOnFailures(this);
    BluetoothMedic.getInstance().setNotificationsEnabled( true, R.drawable.ic_launcher);

  2. Broadcast an 'onScanFailed' to simulate an LE scan failure

    Intent intent = new Intent("onScanFailed");
    intent.putExtra("errorCode",2);
    LocalBroadcastManager.getInstance(RangingActivity.this).sendBroadcast(intent);

  3. Run RangingActivity

We should be able to see a bluetooth power cycling but no notification from BluetoothMedic

Device used : Galaxy Note 8
Android version : 9.0

Attaching screenshots for

before fix
screenshot_notif_warning

after fix
screenshot_after_fix

@davidgyoung
Copy link
Member

Thank you for this pull request, @anuvakkachen. This looks like a very useful and necessary change.

Apologies for taking so long to review this. I will test within the next few days and let you know if any changes are needed before merging.

davidgyoung added a commit that referenced this pull request Jan 26, 2020
@davidgyoung davidgyoung merged commit fad8a3e into AltBeacon:master Jan 26, 2020
@davidgyoung
Copy link
Member

This is now in a 2.16.4 release

@anuvakkachen
Copy link
Contributor Author

Thank you for merging this PR @davidgyoung

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