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

Push通知を届けるために

 Push通知を届けるために

97370d6641bedd9849c3974c65935c0d?s=128

futabooo

July 14, 2015
Tweet

Transcript

  1. Push௨஌Λಧ͚ΔͨΊʹ #potatotips 19 @futabooo

  2. About me futabooo (Takahiro futagawa) - Engineer @eureka - Android

    Developer - ࠷ۙ฀ΓΛײ͍ͯ͡Δ͜ͱ - Ϋϥ΢υϑΝ΢ϯσΟϯάͰߪೖͨ͠ ೣࣖܕϔουϑΥϯͷ։ൃ஗Ԇ 4݄഑ૹ → 10݄഑ૹ  http://www.axentwear.jp/
  3.  About eureka

  4. ࠓ೔࿩͢͜ͱ

  5. ࠓ೔࿩͢͜ͱ - InstanceID - RegistrationID(iOSͰ͍͏σόΠετʔΫϯ) - τϥϒϧγϡʔςΟϯά 

  6. GCMʹ͍ͭͯ

  7. GCMͷྲྀΕ  https://developers.google.com/cloud-messaging/gcm - ࣄલʹRegistrationIDΛอଘ - αʔό͔ΒRegistrationIDΛ࢖ͬͯ PushΛૹ৴ RegistrationID

  8.  GCMͷ࣮૷ʹ͍ͭͯ - ࣮૷ํ๏͸ެࣜυΩϡϝϯτࢀর https://developers.google.com/cloud-messaging/android/legacy-regid - ΞϓϦΞοϓσʔτͰRegistrationID͕ มߋ͞ΕΔͱ͜Ζ΋Χόʔ - ୺຤ͷ࠶ىಈͰ΋มߋ͞ΕΔ৔߹͕͋Δ

    αʔόʹมߋޙͷIDΛૹΒͳ͍ͱ ಧ͔ͳ͘ͳΔ
  9.  ୺຤ͷ࠶ىಈʹରԠ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> AndroidManifest.xml <receiver android:name=".BootReceiver"> <intent-filter> <action

    android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver>
  10.  ୺຤ͷ࠶ىಈʹରԠ BootReceiver.java @Override public void onReceive(Context c, Intent i)

    { //RegistrationIDͷ࠶ొ࿥ॲཧ }
  11. τϥϒϧγϡʔςΟϯά

  12.  τϥϒϧγϡʔςΟϯά - GCM਍அ https://support.google.com/googleplay/android-developer/answer/2663268

  13. τϥϒϧγϡʔςΟϯά - GCM਍அ εςʔλεʹΑͬͯMessage͕ਖ਼ ৗʹಧ͍͔ͨͲ͏͔֬ೝͰ͖Δ 

  14. ͓·͚

  15. ͓·͚ - અిΞϓϦ - ୺຤ͷઅిػೳ - wifiͷ੾அ - Serviceͷఀࢭ Push௨஌Λಧ͚ΔͨΊͷઓ͍͸ଓ͘

    - DozeϞʔυ
  16. Thank you :)