diff options
author | Samuel Holland <samuel@sholland.org> | 2017-07-30 02:01:38 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-07-30 02:01:38 -0500 |
commit | 773190f57d707264586f8e19fbe22ef284dd4e1e (patch) | |
tree | 2f2f462ccd28044e779dfb5db9cce550954e89c2 /app/src | |
parent | d8a5ec3f1999cb07e5f5677ba2f87910d96da98b (diff) |
ProfileService: Add a listener to start it on boot
This will allow automatically starting profiles on boot.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/AndroidManifest.xml | 11 | ||||
-rw-r--r-- | app/src/main/java/com/wireguard/android/BootCompletedReceiver.java | 14 |
2 files changed, 24 insertions, 1 deletions
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 02a8b7fa..2c02aa95 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,6 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.wireguard.android"> + package="com.wireguard.android" + android:installLocation="internalOnly"> + + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <application android:allowBackup="false" @@ -17,6 +20,12 @@ </intent-filter> </activity> + <receiver android:name=".BootCompletedReceiver"> + <intent-filter> + <action android:name="android.intent.action.BOOT_COMPLETED" /> + </intent-filter> + </receiver> + <service android:name=".ProfileService" android:exported="false" /> diff --git a/app/src/main/java/com/wireguard/android/BootCompletedReceiver.java b/app/src/main/java/com/wireguard/android/BootCompletedReceiver.java new file mode 100644 index 00000000..9f7e3dc2 --- /dev/null +++ b/app/src/main/java/com/wireguard/android/BootCompletedReceiver.java @@ -0,0 +1,14 @@ +package com.wireguard.android; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class BootCompletedReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent intent) { + Intent startServiceIntent = new Intent(context, ProfileService.class); + context.startService(startServiceIntent); + } +} |