start service on boot
This commit is contained in:
parent
1124ded200
commit
e4f61da079
|
@ -12,6 +12,7 @@
|
||||||
<uses-permission android:name="android.permission.READ_PROFILE" />
|
<uses-permission android:name="android.permission.READ_PROFILE" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
@ -19,18 +20,28 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@android:style/Theme.Holo.Light" >
|
android:theme="@android:style/Theme.Holo.Light" >
|
||||||
<service android:name="eu.siacs.conversations.services.XmppConnectionService" />
|
<service android:name="eu.siacs.conversations.services.XmppConnectionService" />
|
||||||
|
|
||||||
|
<receiver android:name="eu.siacs.conversations.services.EventReceiver" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||||
|
</intent-filter>
|
||||||
|
</receiver>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="eu.siacs.conversations.ui.ConversationActivity"
|
android:name="eu.siacs.conversations.ui.ConversationActivity"
|
||||||
|
android:configChanges="orientation|screenSize"
|
||||||
android:label="Conversations"
|
android:label="Conversations"
|
||||||
android:windowSoftInputMode="stateHidden"
|
android:windowSoftInputMode="stateHidden" >
|
||||||
android:configChanges="orientation|screenSize">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.SENDTO" />
|
<action android:name="android.intent.action.SENDTO" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
||||||
<data android:scheme="imto" />
|
<data android:scheme="imto" />
|
||||||
<data android:host="jabber" />
|
<data android:host="jabber" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
17
src/eu/siacs/conversations/services/EventReceiver.java
Normal file
17
src/eu/siacs/conversations/services/EventReceiver.java
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package eu.siacs.conversations.services;
|
||||||
|
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
public class EventReceiver extends BroadcastReceiver {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
Intent mIntentForService = new Intent(context, XmppConnectionService.class);
|
||||||
|
if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
context.startService(mIntentForService);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -37,9 +37,9 @@ public abstract class XmppActivity extends Activity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
startService(new Intent(this, XmppConnectionService.class));
|
|
||||||
super.onStart();
|
super.onStart();
|
||||||
if (!xmppConnectionServiceBound) {
|
if (!xmppConnectionServiceBound) {
|
||||||
|
startService(new Intent(this, XmppConnectionService.class));
|
||||||
Intent intent = new Intent(this, XmppConnectionService.class);
|
Intent intent = new Intent(this, XmppConnectionService.class);
|
||||||
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue