I been trying to get write platform code for Flutter to get a background service started. In here, I used a minimal example with no actual work done to show that the application simply won't run. The actual flutter code is not modified at all.
MainActivity.java
public class MainActivity extends FlutterActivity {
  Intent i = new Intent(this, MainService.class);
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);
  }
}
MainService.java
public class MainService extends IntentService {
  public MainService() {
    super("MainService");
  }
  @Override
  protected void onHandleIntent(Intent Intent) {
  }
}
AndroidManifest.xml
 <service android:enabled="true"
android:name=".MainService"></service>
The buildVersion is >27 and Manifest file has the service tag added accordingly.
Compiling and running with flutter run -v will show the following message:
..
[ +121 ms] Starting: Intent { act=android.intent.action.RUN flg=0x20000000 cmp=com.example.hello/.MainActivity (has extras)}
[   +1 ms] Waiting for observatory port to be available...
And the installation is stuck.
Is there a workaround about this? If this is an actual bug in Flutter's implementation, does it also mean there is no way to run a Flutter application in the background?


