Skip to content

Instantly share code, notes, and snippets.

@ByteSizedMarius
Created November 9, 2023 14:35

Revisions

  1. ByteSizedMarius created this gist Nov 9, 2023.
    18 changes: 18 additions & 0 deletions main.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    // 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();
    }