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 8.0のPush受信時のサービス起動について
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
hideoohashi
November 15, 2018
Programming
1.6k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Android 8.0のPush受信時のサービス起動について
hideoohashi
November 15, 2018
More Decks by hideoohashi
See All by hideoohashi
SmartNews 5.0 ちょっと苦労した話 / shibuya.apk #19
hideoohashi
5
5k
Other Decks in Programming
See All in Programming
CodeRabbitの効果検証と過ごしてみた3ヶ月
armondando
0
220
コードで差別化できない時代の ソフトウェアエンジニアリング / Software Engineering in an Era Where Code Doesn’t Differentiate
kishida
2
150
気持ちぃ〜角丸 Squircle
ryu1013
0
220
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
150
プロダクトコードからライブラリの境界を見つける
elmetal
PRO
0
110
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
540
機械に任せるテスト、人が見るテスト ⽣成AIで引き直した、運⽤保守フェーズの線引き
dske104
0
180
IBM Bob でAI駆動開発『QC-Playbook』
ichirokano2
0
110
JRuby: Past, Present, and Future
headius
0
230
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
250
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
460
Featured
See All Featured
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
940
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
340
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.4k
Docker and Python
trallard
47
4.2k
Site-Speed That Sticks
csswizardry
13
1.6k
Chasing Engaging Ingredients in Design
codingconduct
0
350
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
790
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
550
Transcript
Android 8.0のPush受信時の サービス起動について 2018/11/15 - potatotips #56 Hideo Ohashi 1
About Me • Androidエンジニア8年間やってます • 現在はスマートニュース株式会社でAndroidアプ リ開発全般に関わっています 2
Today’s topic • Android 8.0対応時に発生した、Push受信時の バックグラウンドサービス起動の問題と、そこか ら学んだことの共有させていただきたいと思いま す 3
バックグラウンドサービスの制限 • Android 8.0からバックグラウンドサービスの実 行に制限がつきました ◦ https://developer.android.com/about/versions/oreo/background • ただし特定の状況のときは実行制限はなくなり、 優先度高のPush受信もそのうちのひとつです
4
状況 • SmartNewsではPushを受けた後に処理を Serviceに委譲し、別途画像を取得して Notificationを出していました • Android8.0でもそのままで動作するはずが、 startService()の呼び出しで IllegalStateExceptionが発生していました 5
なぜだろうか? 6
原因(たぶん) • 試しに優先度高のPushを受けてから60秒ほど 経った後にstartService()を呼び出したら IllegalStateExceptionが発生しました • onReceive()では基本的にstartService()を呼び 出しているだけなので、Pushを受けてからアプリ のonReceive()が呼ばれるまでの、アプリ側から 手が出せないところで時間がかかってしまってい
る可能性が高い 7
どう解決したか • Serviceを使っていた理由は主に画像ダウン ロードだったので、startService()に失敗した場 合は画像なしでNotificationを出すことで解決さ せました ◦ 多少の情報は落ちてもリアルタイムに表示することを優 先させました 8
まとめ • 何かPushを受けてバックグラウンドサービスを 動かしたいとき、優先度高のPushでも startService()が失敗する場合があることを考え て設計・実装したほうがよさそう 9
ご静聴ありがとうございました 10