added new method, askLocationAndExternalStoragePermission

multipeer_ios
Prerak Mann 5 years ago
parent db7eeabef6
commit 59ca0c8292

@ -75,6 +75,7 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
ActivityCompat.requestPermissions(activity, ActivityCompat.requestPermissions(activity,
new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION}, new String[]{Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION},
0); 0);
Log.d("nearby_connections", "askLocationPermission");
result.success(null); result.success(null);
break; break;
case "checkExternalStoragePermission": case "checkExternalStoragePermission":
@ -89,7 +90,15 @@ public class NearbyConnectionsPlugin implements MethodCallHandler {
case "askExternalStoragePermission": case "askExternalStoragePermission":
ActivityCompat.requestPermissions(activity, ActivityCompat.requestPermissions(activity,
new String[]{Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE}, 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); result.success(null);
break; break;
case "stopAdvertising": case "stopAdvertising":

@ -3,4 +3,4 @@ library nearby_connections;
export 'src/classes.dart'; export 'src/classes.dart';
export 'src/defs.dart'; export 'src/defs.dart';
export 'src/nearby_connections.dart'; export 'src/nearby.dart';

@ -176,6 +176,14 @@ class Nearby {
'askExternalStoragePermission', '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. /// Start Advertising, Discoverers would be able to discover this advertiser.
/// ///
/// [userNickName] and [strategy] should not be null /// [userNickName] and [strategy] should not be null
Loading…
Cancel
Save