Je développe une application à l'aide de Flutter.
Pour afficher la notification, j'utilise flutter_local_notifications a > package.
Je reçois une notification, mais la notification de planification ne fonctionne pas.
Une question similaire a été posée ici Comment planifier une notification dans Flutter? , mais mon destinataire est déjà dans la balise application .
Voici mon manifeste
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.folk.gayatrimonitor">
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="gayatri_monitor"
android:icon="@mipmap/ic_launcher">
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
</intent-filter>
</receiver>
<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">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
3 Réponses :
J'ai eu le même problème mais je n'ai pas pu trouver la solution en ligne, cependant, plus tard, j'ai compris l'exécution de flutter clean puis flutter run semble faire l'affaire pour moi.
Vous devez essentiellement nettoyer votre build et le reconstruire à nouveau. J'espère que cela aide.
l'ajout de cette application interne de votre manifeste pourrait résoudre votre problème
<service android:name="com.folk.localnotifications.services.LocalNotificationsService" android:exported="false" />
N'oubliez pas: com.folk est utilisé uniquement pour ce projet. Pour différents projets, accédez à votre manifeste, consultez le nom du package et modifiez-le en conséquence.
J'ai eu le même problème, je l'ai résolu en créant un canal de notification distinct pour chaque notification Android que j'émettais, même si elles partagent la même priorité.