개발생활/Unity Engine
[FCM] How to use Unity FCM Notification Diabled Code Block/Xcode 11 - ios
한국인맛집
2019. 11. 10. 22:33
반응형
// ANDROID
/Assets/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<application>
<meta-data android:name="firebase_messaging_auto_init_enabled"
android:value="false" />
<meta-data android:name="firebase_analytics_collection_enabled"
android:value="false" />
</application>
FCM Notification Controll in C# [Unity]
if(isNotificated)
FirebaseMessaging.TokenRegistrationOnInitEnabled = false;
// FCM Notification Disabled
}
else{
FirebaseMessaging.TokenRegistrationOnInitEnabled = true;
// FCM Notification enabled
}
// IOS
XCode 11
if(isNotificated)
Firebase.Messaging.FirebaseMessaging.TokenRegistrationOnInitEnabled = false;
// FCM Notification Disabled
}
else{
Firebase.Messaging.FirebaseMessaging.TokenRegistrationOnInitEnabled = true;
// FCM Notification enabled
}
Build
Terminal Goto Your Unity Build Project
// first
$pod init
//seconds
$vi Podfile
platform :ios, '9.0'
target 'Project' do
use_frameworks!
inherit! :search_paths
pod 'FirebaseMessaging'
pod 'FirebaseAuth'
pod 'FirebaseAnalytics'
pod 'Google-Mobile-Ads-SDK', '~> 7.0'
end
open Proejct.xcworkspace
Taget-> General -> Frameworks, libraries, And Embedded contents
import Frameworks.
signing & capabilites
+Capability
1. Add Push notification
2. Add Background Modes
Check Remote notifications
FirebaseMessagingAutoInitEnabled = NO;
반응형