Skip to content

Commit bd99631

Browse files
committed
calling promptForPushPermissions in the Android plugin
1 parent 67b80db commit bd99631

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

android/src/main/java/com/onesignal/flutter/OneSignalPlugin.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ private void userProvidedPrivacyConsent(MethodCall call, Result reply) {
278278
}
279279

280280
private void promptPermission(MethodCall call, Result result) {
281-
OneSignal.onesignalLog(OneSignal.LOG_LEVEL.ERROR, "promptPermission() is not applicable in Android");
281+
boolean fallback = call.argument("fallback");
282+
OneSignal.promptForPushNotifications(fallback);
282283
replySuccess(result, null);
283284
}
284285

lib/onesignal_flutter.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ class OneSignal {
213213
return val as bool;
214214
}
215215

216-
/// in iOS, will prompt the user for permission to send push notifications.
217-
// in Android, it will always return false, since notification permission is by default given
216+
// in iOS and Android 13+, will prompt the user for permission to send push notifications.
217+
// in lower Android versions it will always return false, since notification
218+
// permission is by default given
218219
Future<bool> promptUserForPushNotificationPermission(
219220
{bool fallbackToSettings = false}) async {
220221
dynamic result = await _channel.invokeMethod(

0 commit comments

Comments
 (0)