title: How do I schedule a notification in Flutter?
body: <p>Im using the <a href="https://pub.dartlang.org/packages/flutter_local_notifications" rel="noreferrer">flutter_local_notifications</a> package and im trying to schedule a notification in my Android device.</p>
  
  <p>I successfully created a notification using this package but neither of the scheduled ones seems to work for me </p>
  
  <p>My AndroidManifest.xml looks like this: </p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="..."&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/&gt;
  &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
  
  &lt;receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" /&gt;
  &lt;receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"&gt;
      &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.BOOT_COMPLETED"&gt;&lt;/action&gt;
      &lt;/intent-filter&gt;
  &lt;/receiver&gt;
  &lt;application
      android:name="io.flutter.app.FlutterApplication"
      android:label="notificaciones"
      android:icon="@mipmap/ic_launcher"&gt;
      &lt;activity
          android:name=".MainActivity"
          android:launchMode="singleTop"
          android:theme="@style/LaunchTheme"
          android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
          android:hardwareAccelerated="true"
          android:windowSoftInputMode="adjustResize"&gt;
          &lt;meta-data
              android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
              android:value="true" /&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN"/&gt;
              &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>
  
  <p>I added <code>android.enableAapt2=false</code> to the gradle.properties due to</p>
  
  <p><code>AAPT: error: unknown element &lt;receiver&gt; found</code> as mentioned in <a href="https://stackoverflow.com/questions/46560449/error72-unknown-element-receiver-found">this thread</a> to avoid a build error.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter_local_notifications/flutter_local_notifications.dart';
  
  void main() =&gt; runApp(new MyApp());
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return new MaterialApp(
        title: 'Flutter Demo',
        theme: new ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: new MyHomePage(),
      );
    }
  }
  
  class MyHomePage extends StatefulWidget {
  
    @override
    _MyHomePageState createState() =&gt; new _MyHomePageState();
  }
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
    FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
  
    Future onSelectNotification(String payload) {
      showDialog(
          context: context,
          builder: (_) =&gt; AlertDialog(
                title: Text("ALERT"),
                content: Text("CONTENT: $payload"),
              ));
    }
  
    showNotification() async {
      var android = AndroidNotificationDetails(
          'channel id', 'channel name', 'channel description');
      var iOS = IOSNotificationDetails();
      var platform = NotificationDetails(android, iOS);
      var scheduledNotificationDateTime =
          new DateTime.now().add(Duration(seconds: 10));
      await flutterLocalNotificationsPlugin.schedule(0, 'Title ', 'Body', scheduledNotificationDateTime, platform);
    }
  
    @override
    void initState() {
      super.initState();
      flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
      var android = AndroidInitializationSettings('@mipmap/ic_launcher');
      var iOS = IOSInitializationSettings();
      var initSettings = InitializationSettings(android, iOS);
      flutterLocalNotificationsPlugin.initialize(initSettings,
          selectNotification: onSelectNotification);
    }
  
    @override
    Widget build(BuildContext context) {
      return new Scaffold(
        appBar: new AppBar(
          title: new Text("Demo"),
        ),
        body: new Center(
          child: new Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: &lt;Widget&gt;[],
          ),
        ),
        floatingActionButton: new FloatingActionButton(
          onPressed: showNotification,
          child: new Icon(Icons.notifications),
        ),
      );
    }
  }
  </code></pre>