즉, 유저가 알림을 받을 수 있도록 앱에서 직접 권한 요청 로직을 구현해야 합니다. 아래는 플랫폼별 구현 방법입니다.
- Android
- iOS
- Flutter
- React Native
Android 푸시 알림 사전 동의
- Android TIRAMISU(API 33) 이상에서는 런타임 권한 요청이 필수입니다.
- 노티플라이 Android SDK와는 별개로, 앱에서 직접 권한 요청 코드를 작성해야 합니다.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
노티플라이 SDK에서 푸시 알림 권한 요청을 자동으로 처리하지 않으므로, 앱에서 직접 푸시 알림 권한 요청(사전 동의) 로직을 구현하는 방법을 설명합니다.
// 권한 요청 예시 (Kotlin)
private fun askNotificationPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
ContextCompat.checkSelfPermission(
this,
Manifest.permission.POST_NOTIFICATIONS
) != PackageManager.PERMISSION_GRANTED
) {
ActivityCompat.requestPermissions(
this,
arrayOf(Manifest.permission.POST_NOTIFICATIONS),
101
)
}
}
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, error in
if let error = error {
print("Failed to request authorization: \(error)")
return
} else {
guard granted else {
print("Notification permission denied")
return
}
DispatchQueue.main.async {
UIApplication.shared.registerForRemoteNotifications()
}
}
}
FirebaseMessaging messaging = FirebaseMessaging.instance;
NotificationSettings settings = await messaging.requestPermission(
alert: true,
badge: true,
sound: true,
);
import messaging from '@react-native-firebase/messaging';
await messaging().requestPermission();
