trietho / flutter_beep

A very lite module to play system sounds and beep for flutter apps (no sound files)
BSD 3-Clause "New" or "Revised" License
17 stars 31 forks source link

Getting MissingPluginException. #11

Open chrislaurie-io opened 3 years ago

chrislaurie-io commented 3 years ago

Calling in code FlutterBeep.beep(): Throwse this error in platform_channel.dart:

MissingPluginException(No implementation found for method stopSysSound on channel flutter_beep))

dnsprado commented 3 years ago

Hi guys, got same issue here. Also tried FlutterBeep.playSysSound(AndroidSoundIDs.TONE_CDMA_ABBR_ALERT) and got the same error.

kbaylosis commented 3 years ago

Do this in your MainActivity.kt

import com.gonoter.flutter_beep.FlutterBeepPlugin  // Add this

class MainActivity: FlutterActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState);

        FlutterBeepPlugin.registerWith(registrarFor("com.gonoter.flutter_beep.FlutterBeepPlugin")); // Add this
    }
}
danielle-h commented 2 years ago

@kbaylosis this didn't work for me, still getting the same error.

kbaylosis commented 2 years ago

@danielle-h what version of flutter are you using? that code i provided no longer applies in the latest flutter

danielle-h commented 2 years ago

@kbaylosis I was using the latest flutter at the time. I haven't tried it since, I used a different solution to get a beep in my app.

danielle-h commented 2 years ago

@kbaylosis I tested it now, it's working great, thanks!

thanhbinh84 commented 1 year ago

For java

import com.gonoter.flutter_beep.FlutterBeepPlugin;
import io.flutter.plugin.common.PluginRegistry;
import io.flutter.plugin.common.PluginRegistry.PluginRegistrantCallback;

public class MainActivity extends FlutterActivity implements PluginRegistrantCallback {
    @Override
    public void registerWith(PluginRegistry registry) {
        FlutterBeepPlugin.registerWith(registry.registrarFor("com.gonoter.flutter_beep.FlutterBeepPlugin"));
    }
}

The exception's gone but still don't heard any sound.

FlutterBeep.beep(false);
FlutterBeep.playSysSound(AndroidSoundIDs.TONE_CDMA_ABBR_ALERT);