Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
AndroidーiOS開発比較〜iOSエンジニアから見たAndroidのアレコレ〜
Search
Takaaki Tanaka
April 25, 2016
Programming
1
1.1k
AndroidーiOS開発比較〜iOSエンジニアから見たAndroidのアレコレ〜
Developers.IO 2016 in Nagoyaでの発表資料です。
Takaaki Tanaka
April 25, 2016
Tweet
Share
More Decks by Takaaki Tanaka
See All by Takaaki Tanaka
製造の課題に立ち向かう Manufacturing Data Engine と Manufacturing Connect の ご紹介
kongmingstrap
0
620
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
590
JAWS-UG 福岡 #16 re:Invent 現地に行った人のお話 #jawsugfuk #jawsug
kongmingstrap
0
490
AppMod の開発のイマを知るために現地に潜入した私が見たものは・・・? #GoogleCloudNext
kongmingstrap
0
540
Kong Gateway から読みとく、 API統合・API連携サービスの最新情報 #devio2023
kongmingstrap
0
1.5k
Cloud Run に憧れて Google Cloud を推進している話 / CX事業本部で使われている技術
kongmingstrap
0
210
AWS / Google Cloud / Azure それぞれの推しサービス.pdf
kongmingstrap
0
1.3k
CPUブーストの話
kongmingstrap
0
53
私のAWS愛を聞け! ~ここが好きだよStep Functions~ #devio2022
kongmingstrap
0
1.1k
Other Decks in Programming
See All in Programming
みんなでプロポーザルを書いてみた
yuriko1211
0
260
Snowflake x dbtで作るセキュアでアジャイルなデータ基盤
tsoshiro
2
520
flutterkaigi_2024.pdf
kyoheig3
0
130
카카오페이는 어떻게 수천만 결제를 처리할까? 우아한 결제 분산락 노하우
kakao
PRO
0
110
Quine, Polyglot, 良いコード
qnighy
4
640
イベント駆動で成長して委員会
happymana
1
320
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
230
AWS Lambdaから始まった Serverlessの「熱」とキャリアパス / It started with AWS Lambda Serverless “fever” and career path
seike460
PRO
1
260
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
880
Better Code Design in PHP
afilina
PRO
0
130
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
For a Future-Friendly Web
brad_frost
175
9.4k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
The Invisible Side of Design
smashingmag
298
50k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Building Applications with DynamoDB
mza
90
6.1k
Fireside Chat
paigeccino
34
3k
Product Roadmaps are Hard
iamctodd
PRO
49
11k
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Transcript
%FWFMPQFST*0 ాதɹ໌ɹϞόΠϧΞϓϦαʔϏε෦ ⡥$MBTTNFUIPE *OD ݄ "OESPJEʔJ04։ൃൺֱʙJ04Τϯ δχΞ͔Βݟͨ"OESPJEͷΞϨίϨʙ
ࣗݾհ w ాத໌ w IUUQEFWDMBTTNFUIPEKQBVUIPSUBOBLBUBLBBLJ w ϞόΠϧΞϓϦαʔϏε෦ॴଐ w J04։ൃ୲
⡥$MBTTNFUIPE *OD
ѪݝʹॅΜͰ͍ͨ͜ͱ͋Γ·͢ ⡥$MBTTNFUIPE *OD
ฐࣾͷΑ͋͘Δཁ݅ w "OESPJEJ04ฒߦ։ൃ w ಉ࣌ϦϦʔε w J04ઌߦϦϦʔεͱ͍͏Ҋ݅͋Γ w "QQMFͷ৹ࠪظؒΛ౿·͑ͯJ04Λલ͠Ͱ։ൃ͢Δͱ͍͏͜ ͱ͋Γ
⡥$MBTTNFUIPE *OD
ฐࣾͷΑ͋͘Δ։ൃମ੍ ⡥$MBTTNFUIPE *OD "OESPJEJ04։ൃऀؒͰίʔυϨϏϡʔΛߦ͏͜ͱ͋Δ
ຊ ⡥$MBTTNFUIPE *OD
ϞόΠϧ։ൃʹ͓͍ͯҙ͢Δ w ରԠ04όʔδϣϯʹ͍ͭͯ w ڞ௨ͷυΩϡϝϯτʹ͍ͭͯ w ࣮ํʹ͍ͭͯ ⡥$MBTTNFUIPE *OD
ϞόΠϧ։ൃʹ͓͍ͯҙ͢Δ w ରԠ04όʔδϣϯʹ͍ͭͯ w ڞ௨ͷυΩϡϝϯτʹ͍ͭͯ w ࣮ํʹ͍ͭͯ ⡥$MBTTNFUIPE *OD
ରԠ04όʔδϣϯʹ͍ͭͯ w "OESPJE ⡥$MBTTNFUIPE *OD IUUQEFWFMPQFSBOESPJEDPNJOUMKBBCPVUEBTICPBSET JOEFYIUNM
ରԠ04όʔδϣϯʹ͍ͭͯ w "OESPJE w YܥγΣΞ͕ఔ͋ΔͷͰαϙʔτͤ͟ΔΛಘͳ͍ঢ় گ͕ଟ͍ w ͔Β8FC7JFX͕$IPSPNFϕʔεʹมߋ͞Ε͍ͯΔͨΊɺ 8FC7JFXΛར༻͢ΔҊ݅ҙ͕ඞཁ
⡥$MBTTNFUIPE *OD
ରԠ04όʔδϣϯʹ͍ͭͯ w J04 ⡥$MBTTNFUIPE *OD IUUQTEFWFMPQFSBQQMFDPNTVQQPSUBQQTUPSFKQ
ରԠ04όʔδϣϯʹ͍ͭͯ w J04 w 4XJGUͰ৽نͰ࡞͢Δ߹J04Ҏ্ਪ w 4XJGU $PDPB1PETͰ&NCFEGSBNFXPSL͕ར༻Ͱ͖Δͨ Ί w
ͻͱͭલͷόʔδϣϯʢJ04ʣରԠͰͷγΣΞ֬อ Ͱ͖Δ ⡥$MBTTNFUIPE *OD
ରԠ04όʔδϣϯʹ͍ͭͯ w J04 w 9DPEFͷόʔδϣϯΞοϓରԠʹҙ w 9DPEFͷόʔδϣϯʹΑͬͯαϙʔτ͞ΕΔ4XJGUͷόʔ δϣϯ͕ҧ͏ w 9DPEF4XJGU
w 9DPEF4XJGU w 9DPEF4XJGU w 9DPEF4XJGU w 9DPEF4XJGU w 9DPEF4XJGU ⡥$MBTTNFUIPE *OD
ରԠ04όʔδϣϯʹ͍ͭͯ w "OESPJE w ରԠ04ଟ͍ w 8FC7JFXରԠʹҙ w #-&Ҋ݅ʹҙ w
J04 w 4XJGUͷόʔδϣϯʹҙ w "54ରԠ ⡥$MBTTNFUIPE *OD
ϞόΠϧ։ൃʹ͓͍ͯҙ͢Δ w ରԠ04όʔδϣϯʹ͍ͭͯ w ڞ௨ͷυΩϡϝϯτʹ͍ͭͯ w ࣮ํʹ͍ͭͯ ⡥$MBTTNFUIPE *OD
ڞ௨ͷυΩϡϝϯτʹ͍ͭͯ ⡥$MBTTNFUIPE *OD w ͓٬༷ͱ։ൃଆؒͰΞϓϦͷػೳΛ࣮ݱ͢ΔͨΊʹඞ ཁͳͷΛચ͍ग़͓ͯ͘͠ w "OESPJEJ04։ൃऀͷؒͰڞ௨ͷೝࣝΛ࣋ͯΔ υΩϡϝϯτΛ࡞͓ͯ͘͠
ڞ௨ͷυΩϡϝϯτʹ͍ͭͯ ⡥$MBTTNFUIPE *OD
ڞ௨ͷυΩϡϝϯτʹ͍ͭͯ ⡥$MBTTNFUIPE *OD ͡ΊΑ͏ཁ݅ఆٛdϏΪφʔ͔Βϕςϥϯ·Ͱ
ϞόΠϧ։ൃʹ͓͍ͯҙ͢Δ w ରԠ04όʔδϣϯʹ͍ͭͯ w ڞ௨ͷυΩϡϝϯτʹ͍ͭͯ w ࣮ํʹ͍ͭͯ ⡥$MBTTNFUIPE *OD
࣮ํʹ͍ͭͯ w ։ൃڥɺ࣮ํʹ͍ͭͯॳظஈ֊Ͱܾఆ͓ͯ͠ ͘ w ܾఆͨ͠༰υΩϡϝϯτͱ͓ͯͯ͘͠͠ w ։ൃڥˠ(JU)VCͷ3&"%.&ʹهࡌ w ࣮ํˠ8JLJʹهࡌ
w ৽ͨͳνʔϜϝϯόʔ͕ՃΘͬͨࡍʹҰཡͰ֬ೝͰ͖ ΔυΩϡϝϯτΛඋ͓ͯ͘͠ʢ8JLJΛ׆༻ʣ w "1*༷ཁ݅ఆٛɺઃܭͷࢿྉ͕ҰཡͰ֬ೝͰ͖ΔΑ͏ʹ͠ ͓ͯ͘ ⡥$MBTTNFUIPE *OD
࣮ํͷڞ༗ ⡥$MBTTNFUIPE *OD ύοέʔδ໊ VJ WJFXͳͲͷը໘දࣔʹؔΘΔΫϥεΛ·ͱΊΔ EPNBJO WJFXͷදࣔʹؔΘΔϩδοΫɺΤϯςΟςΟͳͲ ͷϞσϧΫϥεΛ·ͱΊΔ
JOGSB "1*௨৴ɺ%#ΞΫηεɺσʔλอଘΛ·ͱΊΔ w ύοέʔδྨͷҰྫʢ˞͋͘·ͰҰྫͰ͢ʣ
ͦΕͧΕͷ෦ΛͲ͜ʹஔ͢Δ͔ʜ ⡥$MBTTNFUIPE *OD
VJ ⡥$MBTTNFUIPE *OD
VJ ⡥$MBTTNFUIPE *OD
EPNBJO ⡥$MBTTNFUIPE *OD
EPNBJO ⡥$MBTTNFUIPE *OD
JOGSB ⡥$MBTTNFUIPE *OD
JOGSB ⡥$MBTTNFUIPE *OD
࣮ํʹ͍ͭͯ w ը໘ͷ࡞ํ๏ʹؔͯ͠04ʹґଘ͍ͯ͠Δͱ͜Ζ͕ େ͖͍ͷͰɺϨϏϡʔͰ͖ΔΑ͏ʹͳΔ·Ͱ͕͔͔࣌ؒ Δ w ϓϧϦΫΤετʹमਖ਼ͨ͠ը໘ͷεΫϦʔϯγϣοτ ΛషͬͯΒ͏ w "OESPJE
w 9.-ϑΝΠϧΛΰϦΰϦฤू͢Δ w J04 w 4UPSZ#PBSEΛ͏ ⡥$MBTTNFUIPE *OD
࣮ํʹ͍ͭͯ ⡥$MBTTNFUIPE *OD
࣮ํʹ͍ͭͯ ⡥$MBTTNFUIPE *OD
࣮ํʹ͍ͭͯ w ֤෦ͷ୲ൣғΛ໌֬ʹ͢Δ͜ͱͰίʔυϨϏϡʔ ͷࡍʹ෦Λཧղ͢Δ·ͰͷίετΛܰݮ͢Δ w ϩδοΫɺϞσϧΛ͢Δ͜ͱͰ"OESPJEJ04 ։ൃऀ͕ίʔυϨϏϡʔͰ͖ΔൣғΛ૿͢ w ࣮࿙ΕΛແ͘͢
⡥$MBTTNFUIPE *OD
ΞϨίϨ͋Γ·͕͢ ݁ہࣗΒखΛಈ͔࣮ͯͯ͠͠ ͍͔ͳ͍ͱʹ͔ͭͳ͍ ⡥$MBTTNFUIPE *OD
ࣗΒखΛಈ͔͢
1VTI௨Λ "OESPJEͱJ04Ͱ ࣮ͯ͠ΈΔ
1VTI௨Λ࣮ͯ͠ΈΔ w 1VTIαʔϏεͷొ w ($.ʢ(PPHMF$MPVE.FTTBHJOHʣ w "1/4ʢ"QQMF1VTI/PUJpDBUJPO4FSWJDFʣ w 1VTI௨ͷ࡞ w
1VTIϝοηʔδΛ࡞ w 1VTI௨ͷड৴ w 04ຖʹड৴ॲཧΛߦ͏ ⡥$MBTTNFUIPE *OD
1VTI௨Λ࣮ͯ͠ΈΔ ⡥$MBTTNFUIPE *OD IUUQTBXTBNB[PODPNKQTOT "NB[PO4JNQMF/PUJpDBUJPO4FSWJDF 4/4
"OESPJEଆͷ࡞ۀ ⡥$MBTTNFUIPE *OD w ($.ͷొ w ϥΠϒϥϦͷΠϯϙʔτ w ύʔϛογϣϯͷઃఆ
w 1VTIड৴ॲཧͷ࣮ w "NB[PO$PHOJUP*%ͷऔಘ w "NB[PO4/4τʔΫϯͷૹ৴ w ड৴࣌ͷॲཧͷ࣮
J04ଆͷ࡞ۀ ⡥$MBTTNFUIPE *OD w "1/4ͷొ w ϥΠϒϥϦͷΠϯϙʔτ w "NB[PO$PHOJUP*%ͷऔಘ
w "NB[PO4/4τʔΫϯͷૹ৴ w ड৴࣌ͷॲཧ
"84ଆͷ࡞ۀ ⡥$MBTTNFUIPE *OD w "NB[PO$PHOJUPͰ*EFOUJUZQPPMΛ࡞ w "NB[PO4/4Ͱ(PPHMF"OESPJEͷ1MBUGPSN Λ࡞ w
"NB[PO4/4Ͱ"QQMFJ04%FWͷ1MBUGPSNΛ ࡞ w "NB[PO4/4Ͱ5PQJDΛ࡞
։ൃڥ w "OESPJE w "OESPJE4UVEJP w +BWB w J04 w
9DPEF w $PDPB1PETPS$BSUIBHF w 4XJGU ⡥$MBTTNFUIPE *OD
"OESPJEଆͷ࡞ۀ ⡥$MBTTNFUIPE *OD w ($.ͷొ w ϥΠϒϥϦͷΠϯϙʔτ w ઃఆϑΝΠϧͷΠϯϙʔτ
w ύʔϛογϣϯͷઃఆ w 1VTIड৴ॲཧͷ࣮ w "NB[PO$PHOJUP*%ͷऔಘ w "NB[PO4/4τʔΫϯͷૹ৴ w ड৴࣌ͷॲཧͷ࣮
($.ͷొ ⡥$MBTTNFUIPE *OD IUUQTEFWFMPQFSTHPPHMFDPNDMPVENFTTBHJOH
($.ͷొ ⡥$MBTTNFUIPE *OD w HPPHMFTFSWJDFTKTPOΛμϯϩʔυ͢Δ
($.ͷొ ⡥$MBTTNFUIPE *OD w HPPHMFTFSWJDFTKTPOΛϓϩδΣΫτʹՃ͢Δ
ϥΠϒϥϦͷΠϯϙʔτ ⡥$MBTTNFUIPE *OD … android { … }
dependencies { … compile 'com.amazonaws:aws-android-sdk-cognito:2.+' compile 'com.amazonaws:aws-android-sdk-sns:2.+' } w CVJMEHSBEMFΛฤू w "84ͷ4%,Λࢦఆ͢Δ
ϥΠϒϥϦͷΠϯϙʔτ ⡥$MBTTNFUIPE *OD apply plugin: 'com.google.gms.google-services' android {
… } dependencies { … compile "com.google.android.gms:play-services:8.3.0" … } w CVJMEHSBEMFΛฤू w ($.༻ͷϥΠϒϥϦΛద༻͢Δ
ϥΠϒϥϦͷΠϯϙʔτ ⡥$MBTTNFUIPE *OD w "OESPJE4UVEJP͔ΒϥΠϒϥϦΛΠϯϙʔτ͢Δ w ʮ4ZOD1SPKFDUXJUI(SBEMF'JMFTʯΛ࣮ߦ͢Δ
ύʔϛογϣϯͷઃఆ ⡥$MBTTNFUIPE *OD <?xml version="1.0" encoding="utf-8"?> <manifest package="jp.co.kongmings.android.app" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="com.google.android.c2dm.permission.REGISTER" /> </manifest> w "OESPJE.BOJGFTUYNMΛฤू w ύʔϛογϣϯͷઃఆ
1VTIड৴ॲཧͷ࣮ ⡥$MBTTNFUIPE *OD <application … <receiver android:name="com.google.android.gms.gcm.GcmReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND"
> <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="jp.co.kongmings.android.app" /> </intent-filter> </receiver> <service android:name=".infra.service.MsgGcmListenerService" android:exported="false" > <intent-filter> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> </intent-filter> </service> <service android:name=".infra.service.RegistrationIntentService" android:exported="false" /> <service android:name=".infra.service.MsgInstanceIDListenerService" android:exported="false"> <intent-filter> <action android:name="com.google.android.gms.iid.InstanceID"/> </intent-filter> </service> </application> w "OESPJE.BOJGFTUYNMΛฤू
1VTIड৴ॲཧͷ࣮ ⡥$MBTTNFUIPE *OD public class MsgGcmListenerService extends GcmListenerService {
static final String TAG = MsgGcmListenerService.class.getSimpleName(); @Override public void onMessageReceived(String from, Bundle data) { String message = data.getString("message"); sendNotification(message); sendBroadcast(message); } void sendNotification(String message) { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle("Message received!") .setContentText(message) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); manager.notify(0, notificationBuilder.build()); } void sendBroadcast(String message) { Intent broadcastIntent = new Intent(); broadcastIntent.putExtra("message", message); broadcastIntent.setAction("MESSAGE_RECEIVED"); getBaseContext().sendBroadcast(broadcastIntent); } } w ($.͔Βϝοηʔδ͕ฦ͖ͬͯͨ࣌ͷॲཧ
1VTIड৴ॲཧͷ࣮ ⡥$MBTTNFUIPE *OD … void sendNotification(String message) {
Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher) .setContentTitle("Message received!") .setContentText(message) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); manager.notify(0, notificationBuilder.build()); } ... w ௨ηϯλʔʹදࣔͤ͞Δ
1VTIड৴ॲཧͷ࣮ ⡥$MBTTNFUIPE *OD public class MsgGcmListenerService extends GcmListenerService {
… void sendBroadcast(String message) { Intent broadcastIntent = new Intent(); broadcastIntent.putExtra("message", message); broadcastIntent.setAction("MESSAGE_RECEIVED"); getBaseContext().sendBroadcast(broadcastIntent); } } w ϝοηʔδΛड৴ͨ͜͠ͱΛ௨͢Δ
1VTIड৴ॲཧͷ࣮ ⡥$MBTTNFUIPE *OD public class RegistrationIntentService extends IntentService {
public RegistrationIntentService() { super("RegistrationIntentService"); } @Override protected void onHandleIntent(Intent intent) { if (intent != null) { try { InstanceID instanceID = InstanceID.getInstance(this); String token = instanceID.getToken( getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); Prefs.put("token", token); } catch (IOException e) { e.printStackTrace(); } } } } w τʔΫϯऔಘॲཧʹͯτʔΫϯΛอ͓࣋ͯ͘͠
"NB[PO$PHOJUP*%ͷऔಘ ⡥$MBTTNFUIPE *OD void getCognitoId() { new Thread(new Runnable()
{ @Override public void run() { CognitoCachingCredentialsProvider provider = ɹɹɹɹɹɹɹɹɹnew CognitoCachingCredentialsProvider( self, COGNITO_IDENTITY_POOL_ID, AWS_REGION ); final String identityId = provider.getIdentityId(); Prefs.put("cognito_id", identityId); } }).start(); } w $PHOJUP$BDIJOH$SFEFOUJBMT1SPWJEFSʹ $PHOJUP*EFOUJUZ1PPM*%Λࢦఆ͢Δ
"NB[PO4/4τʔΫϯͷૹ৴ ⡥$MBTTNFUIPE *OD void sendToken() { AmazonSNSClient snsClient =
new AmazonSNSClient(mProvider); snsClient.setRegion(Region.getRegion(AWS_REGION)); CreatePlatformEndpointRequest createRequest = new CreatePlatformEndpointRequest(); createRequest.setPlatformApplicationArn(AWS_SNS_APPLICATION_ARN); String token = Prefs.get("token"); createRequest.setToken(token); CreatePlatformEndpointResult platformEndpoint = snsClient.createPlatformEndpoint(createRequest); String endpointArn = platformEndpoint.getEndpointArn(); snsClient.subscribe(AWS_SNS_SUBSCRIBE_TOPIC_ARN, "application", endpointArn); } w ࢦఆͨ͠5PQJDΛ4VTDSJCF͢Δ
ड৴࣌ͷॲཧͷ࣮ ⡥$MBTTNFUIPE *OD private MessageBroadcastReceiver mReceiver; public class
MessageBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Bundle bundle = intent.getExtras(); String message = bundle.getString("message"); Toast.makeText(context, message, Toast.LENGTH_LONG).show(); } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); … mReceiver = new MessageBroadcastReceiver(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("MESSAGE_RECEIVED"); registerReceiver(mReceiver, intentFilter); }
J04ଆͷ࡞ۀ ⡥$MBTTNFUIPE *OD w "1/4ͷొ w ϥΠϒϥϦͷΠϯϙʔτ w "NB[PO$PHOJUP*%ͷऔಘ
w "NB[PO4/4τʔΫϯͷૹ৴ w ड৴࣌ͷॲཧ
"1/4ͷొ ⡥$MBTTNFUIPE *OD IUUQTEFWFMPQFSBQQMFDPNKQEPDVNFOUBUJPO 3FNPUF/PUJpDBUJPOT1(QEG
"1/4ͷొ ⡥$MBTTNFUIPE *OD w ΩʔνΣʔϯΞΫηεΛىಈͯ͠ೝূہʹূ໌ॻΛཁ ٻ͢Δ
"1/4ͷొ ⡥$MBTTNFUIPE *OD
"1/4ͷొ ⡥$MBTTNFUIPE *OD
"1/4ͷొ ⡥$MBTTNFUIPE *OD IUUQTEFWFMPQFSBQQMFDPNMJCSBSZJPTEPDVNFOUBUJPO /FUXPSLJOH*OUFSOFU$PODFQUVBM3FNPUF/PUJpDBUJPOT1( $IBQUFST"QQMF1VTI4FSWJDFIUNM
"1/4ͷొ ⡥$MBTTNFUIPE *OD w 1SPWJTJPOJOH1SPpMF͕ਖ਼͘͠ࢦఆ͞Ε͍ͯΔ͔֬ ೝ͢Δ
ϥΠϒϥϦͷΠϯϙʔτ ⡥$MBTTNFUIPE *OD platform :ios, '8.0' use_frameworks! target 'App'
do pod 'AWSSNS' end w $PDPB1PETܦ༝ͰΠϯϙʔτ͢Δ w 1PEpMFΛฤू
ϥΠϒϥϦͷΠϯϙʔτ ⡥$MBTTNFUIPE *OD w $PDPB1PETܦ༝ͰΠϯϙʔτ͢Δ w QPEJOTUBMMίϚϯυΛ࣮ߦ ➜ app
git:(develop) ✗ bundle exec pod install
"NB[PO$PHOJUP*%ͷऔಘ ⡥$MBTTNFUIPE *OD func application( application: UIApplication, didFinishLaunchingWithOptions launchOptions:
[NSObject: AnyObject]?) -> Bool { let credentialsProvider = AWSCognitoCredentialsProvider( regionType: AWSRegionType.APNortheast1, identityPoolId: CognitoIdentityPoolId) let defaultServiceConfiguration = AWSServiceConfiguration( region: AWSRegionType.APNortheast1, credentialsProvider: credentialsProvider) AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = defaultServiceConfiguration self.registerForRemoteNotifications() return true } w "844FSWJDF.BOBHFSͷઃఆΛ࣮ࢪ w $PHOJUP*EFOUJUZ1PPM*E"84Ͱ࡞ͨ͠ͷΛࢦఆ͢Δ
"NB[PO4/4τʔΫϯͷૹ৴ ⡥$MBTTNFUIPE *OD func application( application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:
NSData) { let deviceTokenString = "\(deviceToken)" .stringByTrimmingCharactersInSet(NSCharacterSet(charactersInString:"<>")) .stringByReplacingOccurrencesOfString(" ", withString: "") … } w τʔΫϯऔಘ࣌ʹݺΕΔϝιου͔ΒτʔΫϯΛऔ ಘ͢Δ
"NB[PO4/4τʔΫϯͷૹ৴ ⡥$MBTTNFUIPE *OD … let sns = AWSSNS.defaultSNS() let
request = AWSSNSCreatePlatformEndpointInput() request.token = deviceTokenString request.platformApplicationArn = AWSSNSApplicationArn sns.createPlatformEndpoint(request).continueWithExecutor( AWSExecutor.mainThreadExecutor(), withBlock: { (task: AWSTask!) -> AnyObject! in if task.error != nil { print("Error: \(task.error)") } else { let createEndpointResponse = task.result as! AWSSNSCreateEndpointResponse let subscribeRequest = AWSSNSSubscribeInput() subscribeRequest.topicArn = self.AWSSNSSubscribeTopicArn subscribeRequest.endpoint = createEndpointResponse.endpointArn subscribeRequest.protocols = "Application" sns.subscribe(subscribeRequest) } return nil }) } w ࢦఆͨ͠5PQJDΛ4VTDSJCF͢Δ
ड৴࣌ͷॲཧ ⡥$MBTTNFUIPE *OD func application( application: UIApplication, didReceiveRemoteNotification userInfo:
[NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) { if application.applicationState == .Active { if let aps = userInfo["aps"] { if let alert = aps["alert"] { let alertController = UIAlertController( title: nil, message: alert, preferredStyle: .Alert) alertController.addAction( UIAlertAction( title: "OK", style: .Default, handler: nil)) self.window?.rootViewController?.presentViewController( alertController, animated: true, completion: nil) } } } } w 1VTIΛड৴ͨ࣌͠ͷॲཧΛهࡌ͢Δ
"84ଆͷ࡞ۀ ⡥$MBTTNFUIPE *OD w "NB[PO$PHOJUPͰ*EFOUJUZQPPMΛ࡞ w "NB[PO4/4Ͱ(PPHMF"OESPJEͷ1MBUGPSN Λ࡞ w
"NB[PO4/4Ͱ"QQMFJ04%FWͷ1MBUGPSNΛ ࡞ w "NB[PO4/4Ͱ5PQJDΛ࡞
"NB[PO$PHOJUPͰ*EFOUJUZQPPMΛ࡞ ⡥$MBTTNFUIPE *OD IUUQBXTBNB[PODPNKQDPHOJUP
"NB[PO$PHOJUPͰ*EFOUJUZQPPMΛ࡞ ⡥$MBTTNFUIPE *OD
"NB[PO4/4Ͱ(PPHMF"OESPJEͷ1MBUGPSNΛ࡞ ⡥$MBTTNFUIPE *OD IUUQTBXTBNB[PODPNKQTOT
"NB[PO4/4Ͱ"QQMFJ04%FWͷ1MBUGPSNΛ࡞ ⡥$MBTTNFUIPE *OD IUUQTBXTBNB[PODPNKQTOT
"NB[PO4/4Ͱ5PQJDΛ࡞ ⡥$MBTTNFUIPE *OD IUUQTBXTBNB[PODPNKQTOT
%&.0 ⡥$MBTTNFUIPE *OD
⡥$MBTTNFUIPE *OD
⡥$MBTTNFUIPE *OD
·ͱΊ ⡥$MBTTNFUIPE *OD w ڞ௨ͷυΩϡϝϯτΛ༻ҙ͢Δ w ϊΠζΛݮΒͯ͠։ൃऀಉ͕࢜ίʔυϨϏϡʔͰ͖Δ ൣғΛ૿͢ w
खΛಈ͔͢
%FWFMPQFST*0 ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ εϥΠυޙϒϩάͰެ։͠·͢ɻ " ⡥$MBTTNFUIPE *OD #cmdevio2016