1
0
mirror of https://github.com/tijder/SmsMatrix.git synced 2024-10-27 18:24:01 +00:00

start service on boot

This commit is contained in:
Phie 2019-11-26 09:10:28 +01:00
parent 4471b7221a
commit faa8984c43
2 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,7 @@
<uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application <application
tools:replace="allowBackup,label" tools:replace="allowBackup,label"
@ -31,6 +32,9 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.PHONE_STATE" /> <action android:name="android.intent.action.PHONE_STATE" />
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver> </receiver>
<service android:name="eu.droogers.smsmatrix.MatrixService" /> <service android:name="eu.droogers.smsmatrix.MatrixService" />

View File

@ -24,6 +24,10 @@ public class ReceiverListener extends BroadcastReceiver {
} else if (intent.getAction().equals("android.intent.action.PHONE_STATE")) { } else if (intent.getAction().equals("android.intent.action.PHONE_STATE")) {
handleIncomingCall(context, intent); handleIncomingCall(context, intent);
} }
else if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
Intent intentServ = new Intent(context, MatrixService.class);
context.startService(intent);
}
} }
private void handleIncomingSMS(Context context, Intent intent) { private void handleIncomingSMS(Context context, Intent intent) {