Skip to content

Instantly share code, notes, and snippets.

@ByteSizedMarius
Created November 9, 2023 14:35
Show Gist options
  • Save ByteSizedMarius/67b90a0af480dbf3aaaf6430ef048f97 to your computer and use it in GitHub Desktop.
Save ByteSizedMarius/67b90a0af480dbf3aaaf6430ef048f97 to your computer and use it in GitHub Desktop.
Flutter: Sending AdGuard intents (Tasker Automation Interface)
// 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