Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Android近距離通信のあれこれ
Search
Takuya Ohashi
February 15, 2018
550
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Android近距離通信のあれこれ
Takuya Ohashi
February 15, 2018
More Decks by Takuya Ohashi
See All by Takuya Ohashi
冴えない彼女の育て方から学ぶ情熱と合理性の使い分け
pg0084
0
560
モバイルアプリでの Amazon Cognito のすゝめ
pg0084
2
550
決戦Kotlinコンバート
pg0084
0
500
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
410
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Abbi's Birthday
coloredviolet
4
10k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
330
The Curse of the Amulet
leimatthew05
3
14k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
67
58k
WCS-LA-2024
lcolladotor
0
830
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
800
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
520
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
65k
Transcript
Androidで用意されている 端末との近距離通信のあれこれ Mobile Act Osaka #3 @pg0084
・オオハシタクヤ @pg0084 ・フェンリルに所属 Androidエンジニア ・静岡県浜松市出身 ・趣味はマクドナルド 自己紹介
Androidの端末間近距離通信について調べてみた
やりたいこと 近距離の端末にメッセージを送る オフライン対応 1対多通信
Android4.0から追加されたNFCを使った通信技術 Android 4.1以降ではNFCで通信を開始したあと はBluetoothに切り替えてコンテンツを送信する 方式になる 「タップしてビーム」これが自分の中で話題に AndroidBeam
良い点 AndroidOSの機能のため、受信側が同じアプリを入れていなくても 良い インターネット接続がなくても通信ができる 比較的大きいデータも早く送受信ができる
NFCなので本当に近くないとできない AndroidBeamの設定がデフォルトでONになっていない端末 が多い 悪い点
条件 近距離の端末にメッセージを送る 〇 オフライン対応 〇 1対多通信 △
Nearby Messages API Google API Console 2015年に公開 Bluetooth、Wi-Fi、人間の耳には聞こえない 音を使って情報を共有を可能にする API
API Keyが必要 iOSのAPIも公開されてます
良い点 近距離の知らない人とも通信ができる OSの隔たりがない (Android、iOSに対応)
オフラインでの利用が不可 耳に聞こえない音と言ったがばっちり音が聞こえる端末があ るらしい(聞いたことない) 100KBまでのデータの送受信(悪い点?) 悪い点
条件 近距離の端末にメッセージを送る ◎ オフライン対応 × 1対多通信 〇
Nearby Connection API 「Google I/O 2017」で発表、バージョンアップされた 完全オフライン対応 通信は「1:N型」と「M:N型」の2種類。 WiFi, Bluetooth
LE & Classic Bluetoothを利用して接続
条件 近距離の端末にメッセージを送る 〇 オフライン対応 〇 1対多通信 〇
Nearby Connection API 実装 AndroidManifest.xml ConnectionsClient
Nearby Connection API 実装 受信側 端末を検出可能状態にする 接続の結果を確認
Nearby Connection API 実装 受信側 接続の要求を受信、接続要求に応じる データの受信 ※rejectConnection()で拒否
Nearby Connection API 実装 送信側 端末を検出を開始 接続の検出、接続要求をする
Nearby Connection API 実装 送信側 データの送信(テキスト) StreamやFileデータもPayloadで送受信可能
良い点 オフラインでの利用が可能 近距離の知らない人とも通信ができる 比較的大きなデータのやりとりも可能
悪い点 GooglePlayService依存
超近距離ですぐ通信を開始する → AndroidBeam Android、iOS隔たりない軽いデータのやりとり → NearbyMessages API、 オフラインでのデータのやりとり → NearbyConnection
API まとめ
ご清聴ありがとうございました