blob: 67e3901e7cfc14e9b1fc323fbed8209b39c08918 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
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;
import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;
public class XmppConnectionService extends Service {
protected static final String LOGTAG = "xmppConnection";
protected DatabaseBackend databaseBackend;
private final IBinder mBinder = new XmppConnectionBinder();
public class XmppConnectionBinder extends Binder {
public XmppConnectionService getService() {
return XmppConnectionService.this;
}
}
@Override
public void onCreate() {
databaseBackend = DatabaseBackend.getInstance(getApplicationContext());
}
@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);
}
}
|