File tree Expand file tree Collapse file tree 2 files changed +1
-14
lines changed
packages/ble/platforms/android Expand file tree Collapse file tree 2 files changed +1
-14
lines changed Original file line number Diff line number Diff line change 3
3
" android.bluetooth:BluetoothProfile" ,
4
4
" android.bluetooth:BluetoothGatt" ,
5
5
" androidx.core.content:ContextCompat" ,
6
- " java.lang:Class" ,
7
- " java.lang.reflect:Method" ,
8
6
" android.bluetooth.le:ScanSettings" ,
9
7
" android.bluetooth:BluetoothDevice" ,
10
8
" java.nio.charset:Charset" ,
Original file line number Diff line number Diff line change @@ -1216,7 +1216,7 @@ export class Bluetooth extends BluetoothCommon {
1216
1216
public locationPermissionGranted ( ) {
1217
1217
let hasPermission = sdkVersion < MARSHMALLOW ;
1218
1218
if ( ! hasPermission ) {
1219
- const ctx = this . _getContext ( ) ;
1219
+ const ctx = Utils . android . getApplicationContext ( ) ;
1220
1220
// CLog(CLogTypes.info, 'app context', ctx);
1221
1221
const neededPermission = sdkVersion < ANDROID10 ? android . Manifest . permission . ACCESS_COARSE_LOCATION : android . Manifest . permission . ACCESS_FINE_LOCATION ;
1222
1222
@@ -2848,17 +2848,6 @@ export class Bluetooth extends BluetoothCommon {
2848
2848
return adapter && adapter . isEnabled ( ) ;
2849
2849
}
2850
2850
2851
- private _getContext ( ) {
2852
- //noinspection JSUnresolvedVariable,JSUnresolvedFunction
2853
- const ctx = java . lang . Class . forName ( 'android.app.AppGlobals' ) . getMethod ( 'getInitialApplication' , null ) . invoke ( null , null ) ;
2854
- if ( ctx ) {
2855
- return ctx ;
2856
- }
2857
-
2858
- //noinspection JSUnresolvedVariable,JSUnresolvedFunction
2859
- return java . lang . Class . forName ( 'android.app.ActivityThread' ) . getMethod ( 'currentApplication' , null ) . invoke ( null , null ) ;
2860
- }
2861
-
2862
2851
private _getActivity ( ) {
2863
2852
const activity = andApp . foregroundActivity || andApp . startActivity ;
2864
2853
if ( activity === null ) {
You can’t perform that action at this time.
0 commit comments