title: Trying to call Android broadcaster in Flutter project
body: <p>I am trying to fetch continous location updates when the application goes to background in Flutter project. Below code does not call the receiver at all.</p>
  
  <p>Below code navigate from .dart file to MainAcitivty.java file.</p>
  
  <pre><code>static const platform = const MethodChannel('samples.flutter.dev/battery');
  
  
    Future&lt;void&gt; getBatteryLevel() async {
      String batteryLevel;
      try {
        final int result = await platform.invokeMethod('getBatteryLevel');
        batteryLevel = 'Battery level at $result % .';
      } on PlatformException catch (e) {
        batteryLevel = "Failed to get battery level: '${e.message}'.";
      }
  
     print("battery level" +batteryLevel);
    }
  </code></pre>
  
  <p>In <strong>MainActivity.java</strong></p>
  
  <pre><code> @Override
    public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
      GeneratedPluginRegistrant.registerWith(flutterEngine);
  
      new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), CHANNEL)
              .setMethodCallHandler(
                      (call, result) -&gt; {
                        // Note: this method is invoked on the main thread.
                        // TODO
                        if (call.method.equals("getBatteryLevel")) {
                          int batteryLevel = getlocation();
                          if (batteryLevel != -1) {
                            result.success(batteryLevel);
                          } else {
                            result.error("UNAVAILABLE", "Battery level not available.", null);
                          }
                        } else {
                          result.notImplemented();
                        }
                      }
  
              );
    }
  
  
    private int getlocation() {
  
      BroadcastReceiver logoutReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
          Log.i("onReceive","Logout in progress");
          finish();
        }
      };
      Log.d("logoutReceiver","logoutReceiver" + logoutReceiver);
  
      return 1;
    }
  
    public class GpsConnectorReceiver extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context context, Intent intent) {
  
        if (intent.getAction().matches("android.location.PROVIDERS_CHANGED")) {
          Intent pushIntent = new Intent(context, ConnectivityCheck.class);
          context.startService(pushIntent);
        }
      }
  }
  </code></pre>
  
  <p>In Manifest.XML i had added receiver - </p>
  
  <pre><code> &lt;receiver
              android:name=".Util.GpsConnectorReceiver"
              android:enabled="true"&gt;
              &lt;intent-filter&gt;
                  &lt;!-- Intent filters for broadcast receiver --&gt;
                  &lt;action android:name="android.location.PROVIDERS_CHANGED" /&gt;
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  </code></pre>