Closed GoogleCodeExporter closed 9 years ago
What happens if you send three messages? Do you get one or two?
Original comment by zele...@gmail.com
on 12 Apr 2012 at 10:03
The last one is always missing. So if I send 3 messages then
smsGetMessageIds() will not return the last one - only the two before it.
send "AAAA"
send "BBBB"
send "CCCC"
smsGetMessageIds will only return the id for "AAAA" and "BBBB".
Original comment by etol...@gmail.com
on 13 Apr 2012 at 3:41
I think I know what's going on. I'll work on a patch for this over the weekend.
Original comment by zele...@gmail.com
on 13 Apr 2012 at 7:18
Try this one.
Original comment by zele...@gmail.com
on 13 Apr 2012 at 11:08
Attachments:
Looking at the patch and the original code, I'm surprised the original code
doesn't work. The cursor returned from the contentresolver query is supposed to
be positioned *before* the first record, so that while(cursor.moveNext())
should just work.
Is this a workaround for an android bug?
Original comment by rjmatthews62
on 14 Apr 2012 at 12:19
Also, does smsGetMessages return the right number?
Original comment by rjmatthews62
on 14 Apr 2012 at 12:21
This one is a little more elegant fix. In addition this fixes smsGetMessages
that has a similar bug.
Original comment by zele...@gmail.com
on 14 Apr 2012 at 1:29
Attachments:
Robbie, while(cursor.moveNext()) moves beyond the first row before
cursor.getInt(0) gets a chance to read the row. It is my understanding that
sqlite reads the row after the cursor, and not before.
Original comment by zele...@gmail.com
on 14 Apr 2012 at 1:31
OK: getSMSMessageIds etc work fine as is.
The problem is one of timing: the SMSReceived message occurs BEFORE message is
inserted into the Inbox. Thus you are getting a race condition.
A short delay before querying message ids should solve the problem.
Original comment by rjmatthews62
on 14 Apr 2012 at 1:34
You are right. Just tested vanilla r5 and I do get all the messages. I am
testing without intent listener, so it may be race indeed.
Original comment by zele...@gmail.com
on 14 Apr 2012 at 2:58
Solution found (comment 9) ... issue is because of a race condition.
Original comment by rjmatthews62
on 14 Apr 2012 at 3:38
Great! Which apk should I use? Or do I wait for the next release?
Original comment by etol...@gmail.com
on 17 Apr 2012 at 1:34
Original issue reported on code.google.com by
etol...@gmail.com
on 11 Apr 2012 at 1:55