benjamindean / flutter_vibration

Handle vibration on iOS and Android in Flutter apps
219 stars 68 forks source link

Does not seem to work in the background #22

Closed wilkomanger closed 3 years ago

wilkomanger commented 4 years ago

When calling Vibration.vibrate in the background (from a callback from firebase_messaging), nothing seems to happen.

benjamindean commented 4 years ago

Are you able to print something out or play a sound from that callback?

wilkomanger commented 4 years ago

Yes, printing works and sounds can also be played.

wilkomanger commented 4 years ago

Actually, it might be a device specific issue. It works on a Samsung Galaxy S9, but not on a Google Pixel 3a.

benjamindean commented 4 years ago

Hmmm. Seems like I have to do a small research about it. It's not the first time it doesn't work on Pixel devices.

chenparty commented 4 years ago

I found the same problem on my huawei-mate30, maybe its caused by android 10. The link is as follows: https://www.jianshu.com/p/3ec9158b2041

maxmblack commented 4 years ago

Same problem appears on OnePlus 7 Pro with Android 10. Couldn't test it on other devices

flashawy commented 4 years ago

doesn't work with oneplus 7T (Android 10) but works with moto G4 Plus ( Android 8.1)

yairsafe commented 3 years ago

Problem appears on Android 10 devices. any solution?

benjamindean commented 3 years ago

@yairsafe @flashawy @maxmblack I think it's related to Android 10 and above, but I don't have the solution at the moment.

wanghaiyang5241 commented 3 years ago

@yairsafe @flashawy @maxmblack我认为它与Android 10及更高版本有关,但目前没有解决方案。

i have pr to you,please look for you

benjamindean commented 3 years ago

@yairsafe @flashawy @maxmblack I merged the PR provided by @wanghaiyang5241, but haven't released a new version yet. Can you, kindly, test it on your devices by installing it from master branch directly?

Just specify it in your pubspec.yml:

vibration:
    git:
      url: git@github.com:benjamindean/flutter_vibration.git
      ref: master
maxmblack commented 3 years ago

@benjamindean sorry for that late response. I just tested on an OnePlus Android 10 and it worked Could you update the package version? Thank you!

yairsafe commented 3 years ago

I tested now on an Samsung S9 (OS Version android 10) and its worked! thanks a lot!

benjamindean commented 3 years ago

@yairsafe @flashawy @maxmblack Version 1.5.0 released.