mirror of
https://github.com/hackku21/nearby_connections.git
synced 2024-10-27 19:14:01 +00:00
added new method, askLocationAndExternalStoragePermission
This commit is contained in:
parent
db7eeabef6
commit
59ca0c8292
@ -75,6 +75,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
||||
ActivityCompat.requestPermissions(activity,
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION},
|
||||
0);
|
||||
Log.d("nearby_connections", "askLocationPermission");
|
||||
result.success(null);
|
||||
break;
|
||||
case "checkExternalStoragePermission":
|
||||
@ -89,7 +90,15 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
|
||||
case "askExternalStoragePermission":
|
||||
ActivityCompat.requestPermissions(activity,
|
||||
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
0);
|
||||
1);
|
||||
Log.d("nearby_connections", "askExternalStoragePermission");
|
||||
result.success(null);
|
||||
break;
|
||||
case "askLocationAndExternalStoragePermission":
|
||||
ActivityCompat.requestPermissions(activity,
|
||||
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION,Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE},
|
||||
1);
|
||||
Log.d("nearby_connections", "askExternalStoragePermission");
|
||||
result.success(null);
|
||||
break;
|
||||
case "stopAdvertising":
|
||||
|
@ -3,4 +3,4 @@ library nearby_connections;
|
||||
|
||||
export 'src/classes.dart';
|
||||
export 'src/defs.dart';
|
||||
export 'src/nearby_connections.dart';
|
||||
export 'src/nearby.dart';
|
||||
|
@ -176,6 +176,14 @@ class Nearby {
|
||||
'askExternalStoragePermission',
|
||||
);
|
||||
|
||||
/// Convinience method
|
||||
///
|
||||
/// Use this instead of calling both [askLocationPermission()] and [askExternalStoragePermission()]
|
||||
Future<void> askLocationAndExternalStoragePermission() async =>
|
||||
await _channel.invokeMethod(
|
||||
'askLocationAndExternalStoragePermission',
|
||||
);
|
||||
|
||||
/// Start Advertising, Discoverers would be able to discover this advertiser.
|
||||
///
|
||||
/// [userNickName] and [strategy] should not be null
|
Loading…
Reference in New Issue
Block a user