Upgrade to Pro — share decks privately, control downloads, hide ads and more …

図解!iOSとFCMで始めるCapacitorのPush通知/Illustration! C...

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

図解!iOSとFCMで始めるCapacitorのPush通知/Illustration! Capacitor Push Notifications Start from iOS and Firebase Cloud Messaging

Push通知やりたいんやあああ
え、簡単なの?Local通知?なにこれめっちゃ簡単じゃん。
Push通知?なにこれめっちゃめんどくさい。
ということで図解してみました

果物リン

July 07, 2019

Transcript

56 slides
  1. 図解!iOSとFCMで始める Capacitor Push通知 גࣜձࣾΏΊΈ Ռ෺ϦϯˏFruitRiin 2019/07/07 Ionic Meetup #12 Tokyo

    Illustration! Capacitor Push Notifications Start from iOS and Firebase Cloud Messaging
  2. 前回のおさらい • Ionic/VueͰCapacitor΋ΠέΔͧɺ
 ໘ന͍ͳ͜Εʂ • Push௨஌ͷ΍Γํ͕Θ͔ΒΜʂ Ionic/Vue is Fun, and

    
 Native app made by Capacitor is also good
 Really interesting. Fooooo! Previous synopsis But, I said I can’t understand 
 to use push Notifications
  3. Two notifications • Local Notifications • Don’t need to receive

    any data from network • Scheduled notifications, need in code • Push Notifications • Notifications from network • Real test devices are need
  4. ローカル通知 • Capacitor ͷLocal NotificationsͷυΩϡϝϯτ௨Γ • LocalNotifications Λcapacitor/coreͷPlugins͔Βల։ • LocalNotifications.schedule({௨஌σʔλ})

    Ͱઃஔ • Plz read capacitior’s Local Notifications Official docs. • Let’s read it codes! Local Notifications
  5. ローカル通知まとめ • ௒؆୯ɻ • υΩϡϝϯτݟͯ3෼ΫοΩϯά You can do it in

    3 minutes Really too easy Conclusion about Local Notifications
  6. Push通知 • Push Notifications ͷυΩϡϝϯτʹ
 ίʔυαϯϓϧ͕ॻ͔Ε͍ͯͳ͍
 ʢAPIυΩϡϝϯτͱconfig͸ॻ͍ͯ͋Δʣ • ͠ΕͬͱExampleͱͯ͠
 Push

    Notifications with FirabaseͳΔΨΠυ΁ No code sample in official docs It link to `Push Notifications with Firebase` Push Notifications
  7. イベントもあるよ! • ΨΠυʹॻ͍ͯ͋Δίʔυͷ΄ͱΜͲ͸͜Ε • PushNotifications.addListener(event, callback) • event͸ ‘registration’, ‘pushNotificationReceived’,


    ‘pushNotificationActionPerformed' ͳͲ There are also events Guide’s code is almost event handling.
 But I cut off previous page sample.
  8. Podfileを編集する • ios/app/Podfile ʹ
 pod ‘Firebase/Messaging’ Λ௥Ճ͢Δ • npx cap

    update ios ͢Δ • Podsʹඞཁͳcapacitor plugin΍
 iOS nativeґଘͷϞδϡʔϧ͕ೖΔ • pod install ͸ෆཁͬΆ͍ Edit Podfile
  9. 案内に従って開発機を登録 • PCͱiOS୺຤྆ํΛͦΕͧΕબͿ • બ୒ࢶʹग़ͳ͚Ε͹Ϗϧυͯ͠ΈΔͱ͔ͯ͠Έͯ • Capabilities ͰPush Notification༗ޮԽΛબ͹ͳ͍ͱग़ͳ͍͔΋ •

    Certification ͱ Identifiers ͕ొ࿥͞ΕΔ Register develop machines follow from guide You did this step,
 register certification and Identifiers
  10. My faults… • I forgot registor .p8 APFs Keys •

    I think it difficult realize to this • I wrote different Pod module • I wrote `Firebase/Core` not `Firebase/Messaging` • I spent 4hours this fail • Don’t show notification dialog while foreground • I failed to remove all events to write this slide
  11. Push通知まとめ • ίʔυ͔͍ͯ • ূ໌ॻͱ伴ͭͬͯ͘ • Firebaseͷઃఆͯ͠ • ϝοηʔδΛૹ৴ʂ Conclusion

    Push Notifications • Write codes • Create certifications 
 and keys • Setting Firebase • Send a message!
  12. リファレンス(1) • Local Notifications - Capacitor
 https://capacitor.ionicframework.com/docs/apis/local-Notifications • Push Notifications

    - Capacitor https:// capacitor.ionicframework.com/docs/apis/push- notifications#method-createChannel-0 • Push Notifications with Firebase in an Ionic/Angular App - Capacitor
 https://capacitor.ionicframework.com/docs/guides/push- notifications-firebase/
  13. リファレンス(2) • iOS ʹ Firebase Cloud Messaging ΫϥΠΞϯτ Ξ ϓϦΛઃఆ͢Δ

    | Firebase
 https://firebase.google.com/docs/cloud- messaging/ios/client?authuser=0 • ͓खܰfirebaseϓογϡ௨஌ূ໌ॻ࡞੒ϝϞ - Qiita
 https://qiita.com/matsuyoro/items/ 77408e5d09ef00be8577

More Decks by 果物リン

Other Decks in Technology