Conversations/src/de/gultsch/chat/services/XmppConnectionService.java

50 lines
1.3 KiB
Java
Raw Normal View History

2014-01-24 02:04:05 +01:00
package de.gultsch.chat.services;
import java.util.List;
import de.gultsch.chat.entities.Conversation;
import de.gultsch.chat.entities.Message;
import de.gultsch.chat.persistance.DatabaseBackend;
2014-01-24 02:04:05 +01:00
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;
2014-01-24 02:04:05 +01:00
public class XmppConnectionService extends Service {
protected static final String LOGTAG = "xmppConnection";
protected DatabaseBackend databaseBackend;
2014-01-24 02:04:05 +01:00
private final IBinder mBinder = new XmppConnectionBinder();
public class XmppConnectionBinder extends Binder {
public XmppConnectionService getService() {
return XmppConnectionService.this;
2014-01-24 02:04:05 +01:00
}
}
@Override
public void onCreate() {
databaseBackend = DatabaseBackend.getInstance(getApplicationContext());
}
2014-01-24 02:04:05 +01:00
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
public void sendMessage(Message message) {
Log.d(LOGTAG,"sending message");
}
public void addConversation(Conversation conversation) {
databaseBackend.addConversation(conversation);
}
public List<Conversation> getConversations(int status) {
return databaseBackend.getConversations(status);
}
2014-01-24 02:04:05 +01:00
}