does anyone know how to debug a FCM notification w...
# android
m
does anyone know how to debug a FCM notification while app is closed
m
App isn’t closed when coming notification, FCM service is running on background. You can select your app in “choose process” screen on android studio.
m
how you will do that
g
Just log incoming message to Logcat
👍 1
if you want to wait for debugger, and cold start of the app (so app is not started yet) just use
android.os.Debug.waitForDebugger()
m
Send notification to yourself while app is closed and FCM Service start to running on background in this moment. You can select your app in “choose process” screen
g
True, but it may be tricky to catch particular moment between app start and moment when you attach it to debugger, waitForDebugger() may help debug such cases
👍 1
m
In my case, App will stop at breakpoint while you click to notification.
g
yes, but it only if you debug some code that runs after click
you may also want to debug code that parses GCM message or register InstanceId token etc, really depends on case
m
Right. Two case can work for you, @Mohamed Ibrahim should try these.
m
thank you guys I'll try that