Search in sources :

Example 1 with PresenceBroadcastReceiver

use of com.googlecode.asmack.contacts.PresenceBroadcastReceiver in project AsmackService by rtreffer.

the class XmppTransportService method onCreate.

/**
     * Initialize the xmpp service, binding all required receivers.
     */
@Override
public void onCreate() {
    super.onCreate();
    accountManager = AccountManager.get(this);
    ContentProviderClient provider = getContentResolver().acquireContentProviderClient(ContactsContract.AUTHORITY_URI);
    ContactDataMapper mapper = new ContactDataMapper(provider);
    BroadcastReceiver receiver = new PresenceBroadcastReceiver(mapper);
    registerReceiver(receiver, new IntentFilter(XmppTransportService.XMPP_STANZA_INTENT));
    receiver = new DiscoReceiver();
    registerReceiver(receiver, new IntentFilter(XmppTransportService.XMPP_STANZA_INTENT));
    receiver = new KeepaliveActionIntentReceiver(this);
    ;
    registerReceiver(receiver, new IntentFilter(Intent.ACTION_TIME_TICK));
    receiver = new SendStanzaReceiver(this);
    registerReceiver(receiver, new IntentFilter(XMPP_STANZA_SEND_INTENT));
    receiver = new ConnectivityReceiver(this);
    registerReceiver(receiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    accountManager.addOnAccountsUpdatedListener(this, null, true);
}
Also used : ContactDataMapper(com.googlecode.asmack.contacts.ContactDataMapper) IntentFilter(android.content.IntentFilter) DiscoReceiver(com.googlecode.asmack.disco.DiscoReceiver) PresenceBroadcastReceiver(com.googlecode.asmack.contacts.PresenceBroadcastReceiver) PresenceBroadcastReceiver(com.googlecode.asmack.contacts.PresenceBroadcastReceiver) BroadcastReceiver(android.content.BroadcastReceiver) ContentProviderClient(android.content.ContentProviderClient)

Aggregations

BroadcastReceiver (android.content.BroadcastReceiver)1 ContentProviderClient (android.content.ContentProviderClient)1 IntentFilter (android.content.IntentFilter)1 ContactDataMapper (com.googlecode.asmack.contacts.ContactDataMapper)1 PresenceBroadcastReceiver (com.googlecode.asmack.contacts.PresenceBroadcastReceiver)1 DiscoReceiver (com.googlecode.asmack.disco.DiscoReceiver)1