Introduction
When push notifications do not behave as expected, Pushwoosh support often asks for the full device console log. The log shows whether the device actually registered with Pushwoosh and what the server answered, which is usually enough to identify the problem — and it is something you can check yourself as a first troubleshooting step.
iOS
If you have access to your app's source code, set the SDK log level to VERBOSE first. Add or edit the Pushwoosh_LOG_LEVEL key in your Info.plist. Possible values:
-
NONE— no logs from the SDK -
ERROR— errors only -
WARNING— also warnings -
INFO— also informational messages -
DEBUG— also debug information -
VERBOSE— everything the SDK can print
See Controlling the log level for native iOS in the Pushwoosh documentation.
To read the log, connect the device to your Mac, open the Console app (Launchpad → Console) and select your device in the left sidebar. You can also use Xcode: Window → Devices and Simulators, select the connected device and open the console pane.
Start the app on the device, allow push notifications when prompted, then select the whole log and copy it into a text file.
What to look for
The /registerDevice request is the interesting part. A healthy request and response look like this (values will differ; the field set is what matters):
| Pushwoosh request:
| Url: https://XXXXX-XXXXX.api.pushwoosh.com/json/1.3/registerDevice
| Payload: {"request":{"gateway":"production","application":"XXXXX-XXXXX","device_type":1,
| "userId":"...","language":"en","hwid":"...","package":"com.example.app",
| "timezone":"25200","push_token":"...","os_version":"...","v":"...","device_model":"..."}}
| Status: "200 no error"
| Response: {"status_code":200,"status_message":"OK","response":{...}}
A notice with the push token of the device should be present as well:
<Notice>: [PW] [I] -[PWPushNotificationsManagerCommon] Registered for push notifications: <token>
Android
If you have access to the app's source code, set the log level to NOISE by adding the com.pushwoosh.log_level meta-data with value NOISE to AndroidManifest.xml. See Controlling the log level for native Android.
Then use Logcat in Android Studio: View → Tool Windows → Logcat. Connect the device, launch the app, wait about 30 seconds, then select the log and copy it into a text file. (The old Android Device Monitor tool was removed from Android Studio years ago; Logcat replaces it. From a terminal you can also run adb logcat.)
What to look for
[RequestManager]
| Pushwoosh request:
| Url: https://XXXXX-XXXXX.api.pushwoosh.com/json/1.3/registerDevice
| Payload: {"request":{"application":"XXXXX-XXXXX","hwid":"...","v":"...","device_type":3,
| "userId":"...","device_name":"Phone","language":"en","timezone":25200,
| "android_package":"com.example.app","device_model":"...","os_version":"...",
| "app_version":"...","push_token":"..."}}
| Response: {"status_code":200,"status_message":"OK","response":null}
[RequestManager] registerDevice response success
[DeviceRegistrar] Registered for pushes: <token>
If you see the /registerDevice request with a non-empty push_token and a 200 OK response, the device is registered correctly and the problem lies elsewhere. If the request is missing, fails, or the token is empty, send the full log to Pushwoosh support.
Comments
0 comments
Please sign in to leave a comment.