private void updateOrInsertToLog(Message msg) {
RealmQuery<RealmMessagesLog> query = realm.where(RealmMessagesLog.class); query.equalTo("PacketID", msg.getPacketID()); RealmResults<RealmMessagesLog> result = query.findAll(); if(result.size() > 0) { realm.beginTransaction(); result.get(0).setPacketID(msg.getPacketID()); result.get(0).setType(msg.getType().toString()); result.get(0).setSubject(msg.getSubject()); result.get(0).setBody(msg.getBody()); realm.commitTransaction(); } else { realm.beginTransaction(); RealmMessagesLog msg_log = realm.createObject(RealmMessagesLog.class); msg_log.setBody(msg.getBody()); msg_log.setSubject(msg.getSubject()); msg_log.setType(msg.getType().toString()); msg_log.setPacketID(msg.getPacketID()); realm.commitTransaction(); } }@Override public int onStartCommand(Intent intent, int flags, int startId) { accManager = new AccountManager(this); realm = Realm.getInstance(this); BusProvider.getInstance().register(this); connectToXMPPServer(); return Service.START_STICKY; }--
You received this message because you are subscribed to the Google Groups "Realm Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to realm-java+...@googlegroups.com.
To post to this group, send email to realm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/realm-java/b48e439d-a28c-4d40-b5a5-5edc91e4281e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
private Realm realm; @Override public int onStartCommand(Intent intent, int flags, int startId) { accManager = new AccountManager(this); realm = Realm.getInstance(this); BusProvider.getInstance().register(this); connectToXMPPServer(); return Service.START_STICKY; }Damn it! After a night to sleep on it and another look, it was very obvious, turns out the ASmack method for 'processPacket' where the function was being called was actually on a separate thread. All fixed, thanks!
On Thu, Nov 27, 2014 at 11:59 AM UTC, Joe Scott <br...@live.co.uk> wrote:
Damn it! After a night to sleep on it and another look, it was very
obvious, turns out the ASmack method for 'processPacket' where the function
was being called was actually on a separate thread. All fixed, thanks!
On Thu, Nov 27, 2014 at 11:58 AM UTC, Help <he...@realm.io> wrote:
Hi Joe
Yes, from a quick glance it looks alright. Without more code, it is hard to tell. Are you in a position to share the code? You can always send it to he...@realm.io for full confidentiality.