-
Notifications
You must be signed in to change notification settings - Fork 422
Content resolver Observable produces duplicates sometimes/usually #72
Comments
|
I removed the compose step (with the dialog box) and put the dialog box in the subscriber, where it probably belongs. It worked just fine until I rebooted the phone |
The regression occurs after I reboot the phone and happens on more than one device. |
Can you expand at all on what you're doing inside of |
In my latest test, I'm using distinct without a function. My Message class has a properly implemented
Single Message, I only want the latest.
I don't have to wait and it doesn't change if I do wait. After reboot, it always happens. If I
.flatMap( (Func1) (query) -> {
Message message = new Message();
Cursor cursor = query.run();
if (cursor.getCount() > 0) {
cursor.moveToNext();
String body = cursor.getString(cursor.getColumnIndex("body"));
int type = cursor.getInt(cursor.getColumnIndex(SMS_COLUMN_TYPE));
Long datetime = cursor.getLong(cursor.getColumnIndex(SMS_COLUMN_DATE));
message.setStatusFromType(type);
message.message = body;
message.to = cursor.getString(cursor.getColumnIndex(SMS_COLUMN_ADDRESS));
message.datetime = datetime;
}
return Observable.just((Message) message);
}); |
The phones I've tried:
|
"Multithreading is hard" might be the answer to my problem. I'm trying to ensure that my background service is started no matter what. Both on boot and when the Application is started. I'm guessing onCreate is called twice and my stream is set up twice on boot. Ugh, if this is the case and it's likely, sorry about all of this noise. 😔 😞 |
Sorry about the cryptic title. The issue is better expressed with some code and an explanation.
I'm creating an Observable for listening to sms messages, specifically I care about sent messages.
Even after filtering on "sent" I'll get about 5 or 6
Message
objects per actual sent sms message. When I first push a build to my phone, everything works as expected. Some unknown time later (I usually notice the next day) two identicalMessage
objects passdistinct()
. Specifically the first two.Message
has correctly implementedequals()
andhashCode()
.This may or may not be an issue with SqlBrite but I've been battling this for a while so I'm exploring all of my options. (I have a similar message out on the RxJava mailing list).
The text was updated successfully, but these errors were encountered: