简体   繁体   中英

Deleting Android Calendar when app is uninstalled

I've been writing an app that has Calendar support using the Android Calendar Provider. I want my app updates the calendar I already create with new events.

Right now I can create a Calendar and add Events to it. The problem I'm facing is that I .

I read about the android.intent.action.PACKAGE_REMOVED broadcast, but I can't catch my own broadcast. The Calendar is created Locally, is not synced. Also, I'm writing the app with support to API 10.

Not possible with a completely client side solution. An app can not listen for it's own uninstall broadcast.

I know this is not what you're looking for and is much more work, but just for fun...if you REALLY need this functionality, you could do something like:

  1. In your app, request OAuth access to edit a user's Google calendar for a particular account. Store the access/refresh token on the server side.
  2. Have your app ping your server occasionally, or use Push on the server side to ping your app and see if it's still installed.
  3. If you find that the app is not installed, have your server edit the user's Google Calendar to remove events created by your app. To be nice, revoke your own OAuth access and delete any tokens or otherwise user-related information you've stored on the server side.

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