Skip to content

Commit

Permalink
Merge pull request #48 from daadu/#45
Browse files Browse the repository at this point in the history
making plugin foreground only
  • Loading branch information
Florian authored Nov 8, 2019
2 parents a8bb37f + de54e54 commit d53e3ae
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ private WifiIotPlugin(Activity poActivity) {
* Plugin registration.
*/
public static void registerWith(Registrar registrar) {
if (registrar.activity() == null) {
// When a background flutter view tries to register the plugin, the registrar has no activity.
// We stop the registration process as this plugin is foreground only.
return;
}
final MethodChannel channel = new MethodChannel(registrar.messenger(), "wifi_iot");
final EventChannel eventChannel = new EventChannel(registrar.messenger(), "plugins.wififlutter.io/wifi_scan");
final WifiIotPlugin wifiIotPlugin = new WifiIotPlugin(registrar.activity());
Expand Down

0 comments on commit d53e3ae

Please sign in to comment.