Reports crashes on the watch app into the phone app's crash report system.
Works with any [third party] crash reporter installed on the Phone app.
We install a crash handler on the watch Virtual Machine, when a crash is caught, its trace and type are serialized to json, saved to the FileSystem, then sent with a service as a MessageApi Message. Upon reception by a WearableListenerService in the phone app it is deserialized and passed to the installed Phone Virtual Machine's crash reporter.
The top of the stack trace then looks like:
Thread [#] โ WearableListenerService
in the crash report
Setting it up:
- Add to project build.gradle's repositories section:
maven { url = 'http://dl.bintray.com/stubhub/maven' }
- Add to build.gradle:
compile "com.google.android.gms:play-services-wearable:$play_services_version"
compile 'com.stubhub.crash:wear-crash-reporter:1.0.2@aar'
- Add the following to the manifest:
service name com.stubhub.crash.phone.WearCrashListenerService
intent-filter
action name com.google.android.gms.wearable.MESSAGE_RECEIVED
data scheme="wear" host="*" pathPrefix "/wear-crash-peer"
- Add the following item to wear.xml's android_wear_capabilities:
wear_crash_peer_capability
- Add to build.gradle:
compile "com.android.support:wear:$support_version"
compile "com.google.android.support:wearable:$latest_wear_libraries_version" provided "com.google.android.wearable:wearable:$latest_wear_libraries_version"
compile "com.google.android.gms:play-services-wearable:$play_services_version"
compile 'com.stubhub.crash:wear-crash-reporter:1.0.2@aar'
- Add the following to the manifest:
service name com.stubhub.crash.watch.WearCrashLoggingService
- Call the following in your Application class' onCreate:
WearCrashHelper.getInstance().startAgent(getApplicationContext());
Copyright 2017 Ebay, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.