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 33        " android.bluetooth:BluetoothProfile"  ,
44        " android.bluetooth:BluetoothGatt"  ,
55        " androidx.core.content:ContextCompat"  ,
6-         " java.lang:Class"  ,
7-         " java.lang.reflect:Method"  ,
86        " android.bluetooth.le:ScanSettings"  ,
97        " android.bluetooth:BluetoothDevice"  ,
108        " java.nio.charset:Charset"  ,
Original file line number Diff line number Diff line change @@ -1216,7 +1216,7 @@ export class Bluetooth extends BluetoothCommon {
12161216    public  locationPermissionGranted ( )  { 
12171217        let  hasPermission  =  sdkVersion  <  MARSHMALLOW ; 
12181218        if  ( ! hasPermission )  { 
1219-             const  ctx  =  this . _getContext ( ) ; 
1219+             const  ctx  =  Utils . android . getApplicationContext ( ) ; 
12201220            // CLog(CLogTypes.info, 'app context', ctx); 
12211221            const  neededPermission  =  sdkVersion  <  ANDROID10  ? android . Manifest . permission . ACCESS_COARSE_LOCATION  : android . Manifest . permission . ACCESS_FINE_LOCATION ; 
12221222
@@ -2848,17 +2848,6 @@ export class Bluetooth extends BluetoothCommon {
28482848        return  adapter  &&  adapter . isEnabled ( ) ; 
28492849    } 
28502850
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- 
28622851    private  _getActivity ( )  { 
28632852        const  activity  =  andApp . foregroundActivity  ||  andApp . startActivity ; 
28642853        if  ( activity  ===  null )  { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments