Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close app when app stop #17

Merged
merged 1 commit into from Nov 13, 2020

Conversation

cdfq152313
Copy link
Contributor

Situation

In AndroidMainifest set

<service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService" android:stopWithTask="true"/>

Foreground service will kill after app is closed by user.

However, other flutter plugin(ex: GPS) still send data to flutter channel. It will cause flutter continually throw Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: flutter.baseflow.com/geolocator_updates. Response ID: 0 error message.

Workaround

If foreground service is not closed by user(which means closed by system), close app as well.

[Situation]

In AndroidMainifest set
```
<service android:name="changjoopark.com.flutter_foreground_plugin.FlutterForegroundService" android:stopWithTask="true"/>
```

Foreground service will kill after app is closed by user.

However, other flutter plugin(ex: GPS) still send data to flutter
channel. It will cause flutter continually throw `Tried to send a
platform message to Flutter, but FlutterJNI was detached from native
C++. Could not send. Channel: flutter.baseflow.com/geolocator_updates.
Response ID: 0` error message.

[Workaround]
If foreground service is not closed by user(which means closed by system), close app as well.
@SGuzel
Copy link

SGuzel commented Oct 6, 2020

Hi all,
It seems to be the solution for closing detached foregroundservices to the app.
Could anybody merge this pull request?

  • Thanks

@ChangJoo-Park ChangJoo-Park self-assigned this Nov 13, 2020
@ChangJoo-Park
Copy link
Owner

Thanks @cdfq152313 and @SGuzel too.
I am too late to check this PR. It works well.

@ChangJoo-Park ChangJoo-Park merged commit 6209d16 into ChangJoo-Park:master Nov 13, 2020
@ChangJoo-Park
Copy link
Owner

Updated 0.6.0 with this PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants