Created
November 9, 2023 14:35
-
-
Save ByteSizedMarius/67b90a0af480dbf3aaaf6430ef048f97 to your computer and use it in GitHub Desktop.
Flutter: Sending AdGuard intents (Tasker Automation Interface)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://adguard.com/kb/adguard-for-android/solving-problems/tasker/ | |
// https://pub.dev/packages/android_intent_plus | |
import 'package:android_intent_plus/android_intent.dart'; | |
Future<void> setAdguard(bool active, {bool quiet=false}) async { | |
AndroidIntent intent = AndroidIntent( | |
action: active ? "start" : "stop", | |
componentName: "com.adguard.android.receiver.AutomationReceiver", | |
package: "com.adguard.android", | |
arguments: { | |
"password": "<password set in adguard settings>", | |
// If false, adguard may send a toast, confirming the action | |
"quiet:" quiet, | |
}, | |
); | |
await intent.sendBroadcast(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment