Created
July 23, 2023 14:02
-
-
Save an01f01/fc449d4c1927d2676631dd3dd4da2251 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
procedure TFrmMain.FormCreate(Sender: TObject); | |
begin | |
{$IFDEF IOS} | |
if NotificationCenter1.AuthorizationStatus <> TAuthorizationStatus.Authorized then begin | |
NotificationCenter1.RequestPermission; | |
end; | |
{$ENDIF} | |
{$IFDEF ANDROID} | |
if NotificationCenter1.AuthorizationStatus <> TAuthorizationStatus.Authorized then begin | |
NotificationCenter1.RequestPermission; | |
end; | |
if PermissionsService.IsPermissionGranted('android.permission.POST_NOTIFICATIONS') <> True then begin | |
PermissionsService.RequestPermissions(['android.permission.POST_NOTIFICATIONS'], | |
procedure(const APermissions: TClassicStringDynArray; const AGrantResults: TClassicPermissionStatusDynArray) | |
begin | |
if AGrantResults[0] <> TPermissionStatus.Granted then | |
ShowMessage('Please enable notifications for EMA reminders'); | |
end | |
); | |
end; | |
{$ENDIF} | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment