Skip to content

Sound and vibration not working! #13

@valeriomarchetti

Description

@valeriomarchetti

Hi dear,
I have a problem with enableSound and enableVibration. These flags seem are not working if I set both to true.

void periodicTaskFun() {
  FlutterForegroundServicePlugin.executeTask(() async {
    // this will refresh the notification content each time the task is fire
    // if you want to refresh the notification content too each time
    // so don't set a low period duretion because android isn't handling it very well
    await FlutterForegroundServicePlugin.refreshForegroundServiceContent(
      notificationContent: NotificationContent(
          iconName: 'ic_launcher',
          titleText: 'Title Text',
          bodyText: '${DateTime.now()}',
          subText: 'subText',
          color: Colors.red,
          enableSound: true,
          enableVibration: true),
    );

    print(DateTime.now());
  });
}

I have also tried to change the NotificationContent priority and the NotificationChannelContent importance, but nothing..

P.S. I have already set the android permission to the AndroidManifest

<uses-permission android:name="android.permission.VIBRATE" />

Could you help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions