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

Draft: Raise minimum Android compile SDK to v33 #1023

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/capacitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ jobs:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- jdk: 17
capacitor: latest
node: 18.x
- jdk: 17
capacitor: 5
node: 18.x
- jdk: 11
capacitor: 4
node: 14.x
Expand Down
101 changes: 101 additions & 0 deletions .github/workflows/cordova.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Cordova

on:
workflow_dispatch:
push:
branches: ['master']
pull_request:
branches: ['master']

jobs:
cordova-android:
name: cordova@${{ matrix.cordova }} android@${{ matrix.platform }}
runs-on: ubuntu-${{ matrix.ubuntu }}

strategy:
fail-fast: false
matrix:
include:
- jdk: 17
cordova: latest
platform: latest
node: 18.x
ubuntu: 22.04
android-cmdline-tools-version: 10406996
- jdk: 16
cordova: 12
platform: 12
node: 18.x
ubuntu: 22.04
android-cmdline-tools-version: 9862592
- jdk: 11
cordova: 11
platform: 11
node: 14.x
ubuntu: 20.04
android-cmdline-tools-version: 9862592
- jdk: 11
cordova: 11
platform: 10
node: 14.x
ubuntu: 20.04
android-cmdline-tools-version: 9862592
- jdk: 8
cordova: 10
platform: 10
node: 14.x
ubuntu: 20.04
android-cmdline-tools-version: 8512546

steps:
- uses: actions/checkout@v3
- name: Setup JDK ${{ matrix.jdk }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.jdk }}
distribution: 'temurin'
- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: ${{ matrix.android-cmdline-tools-version }}
- name: Build test app
run: |
sdkmanager "build-tools;30.0.3"
sdkmanager "build-tools;34.0.0"
npm install -g cordova@${{ matrix.cordova }}
cordova create temp
cd temp
cordova platform add android@${{ matrix.platform }}
cordova plugin add .. --noregistry --force --link
cordova build android

cordova-ios:
name: cordova@${{ matrix.cordova }} ios@${{ matrix.platform }}

runs-on: macos-latest

strategy:
matrix:
include:
- cordova: latest
platform: latest
node: 18.x

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Build test app
run: |
npm install -g cordova@${{ matrix.cordova }}
cordova create temp
cd temp
cordova platform add ios@${{ matrix.platform }}
cordova plugin add .. --noregistry --force --link
cordova build ios
96 changes: 0 additions & 96 deletions .github/workflows/cordova.yml

This file was deleted.

20 changes: 17 additions & 3 deletions src/android/BLECentralPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,14 @@ public void onReceive(Context context, Intent intent) {
String action = intent.getAction();

if (BluetoothDevice.ACTION_PAIRING_REQUEST.equals(action)) {
BluetoothDevice bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
BluetoothDevice bluetoothDevice;
if (Build.VERSION.SDK_INT >= 33) {
bluetoothDevice = intent.getParcelableExtra(
BluetoothDevice.EXTRA_DEVICE,
android.bluetooth.BluetoothDevice.class);
} else {
bluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
}
int type = intent.getIntExtra(BluetoothDevice.EXTRA_PAIRING_VARIANT, BluetoothDevice.ERROR);

if (type == BluetoothDevice.PAIRING_VARIANT_PIN) {
Expand Down Expand Up @@ -1500,8 +1507,15 @@ private void addBondStateListener() {
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (ACTION_BOND_STATE_CHANGED.equals(action)) {
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
Peripheral peripheral = peripherals.get(device.getAddress());
BluetoothDevice device;
if (Build.VERSION.SDK_INT >= 33) {
device = intent.getParcelableExtra(
BluetoothDevice.EXTRA_DEVICE,
android.bluetooth.BluetoothDevice.class);
} else {
device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
}
Peripheral peripheral = device != null ? peripherals.get(device.getAddress()) : null;

if (peripheral != null) {
int bondState = intent.getIntExtra(EXTRA_BOND_STATE, BluetoothDevice.ERROR);
Expand Down
Loading
Loading