2015-07-14

Debugging Android Wear support for K-9 Mail

I started a branch to develop proper Android Wear support for the popular K-9 mail client.
The last few weeks I was grinding on a strange error.
It would create PendingIntents for the different actions for each individual message.
Because on Wear the messages are shown as a stack and you can act on each of them.

What I found was that it would issue the right action...on the wrong message.
Always the firt message of the notificaiton.


I think I found it.
PendingIntents are not created. They are requested.
If the same PendingIntent already exists, it is returned.
The "same" means same Action, same Data, ...  But not same Extras.
The message ID was transmitted as an Extra.

This was no problem up to now, because most people you would only ever have one notification.
But even in the existing code this bug would have hit (and hit hard inc ase of the  "delete" action) if you have multiple accounts configured and choose an action on the second notification, you would get it with the parameters of the same action on the first notification.

I'm considering the Android Wear branch of K-9 to be BETA-quality now
and am using it myself daily to find bugs.
Kommentar veröffentlichen