简体   繁体   中英

How to prevent background service from crashing in Android

I am using the google calendar api to fetch the user data from a background service.

The service runs periodically to fetch the user data from the api and some operation is performed on that data. Since it is a background service there is no user interaction when I fetch the data after the authorization process.

So what is the correct way of handling the crash that might be caused due to failure of the service.

First analyze the root cause of the crash ,check the log proper . most of the time it may occur because of the null pointer exception.Handle all the null from the service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM