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 8.0のPush受信時のサービス起動について
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
hideoohashi
November 15, 2018
Programming
2
1.6k
Android 8.0のPush受信時のサービス起動について
hideoohashi
November 15, 2018
Tweet
Share
More Decks by hideoohashi
See All by hideoohashi
SmartNews 5.0 ちょっと苦労した話 / shibuya.apk #19
hideoohashi
5
4.8k
Other Decks in Programming
See All in Programming
ノイジーネイバー問題を解決する 公平なキューイング
occhi
0
130
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
3
290
ぼくの開発環境2026
yuzneri
1
290
JPUG勉強会 OSSデータベースの内部構造を理解しよう
oga5
2
220
AI & Enginnering
codelynx
0
140
kintone + ローカルLLM = ?
akit37
0
120
CSC307 Lecture 12
javiergs
PRO
0
450
AWS re:Invent 2025参加 直前 Seattle-Tacoma Airport(SEA)におけるハードウェア紛失インシデントLT
tetutetu214
2
130
株式会社 Sun terras カンパニーデック
sunterras
0
1.9k
Package Management Learnings from Homebrew
mikemcquaid
0
280
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
150
あなたはユーザーではない #PdENight
kajitack
4
280
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
How to Think Like a Performance Engineer
csswizardry
28
2.5k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
68
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
220
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
59
The Invisible Side of Design
smashingmag
302
51k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3.1k
Designing Experiences People Love
moore
144
24k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
67
37k
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