[TIMOB-26953] Android: Modify Service.foregroundNotify() to support "foregroundServiceType" for Android Q
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | None |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2019-10-03T15:24:09.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 8.3.0 |
| Components | Android |
| Labels | android, foreground, location, service |
| Reporter | Joshua Quick |
| Assignee | Gary Mathews |
| Created | 2019-03-29T22:16:19.000+0000 |
| Updated | 2019-10-03T15:27:47.000+0000 |
Description
*Summary:*
Android Q requires foreground services to set a new "foregroundServiceType" setting to "location" in order to collect location data while the app is backgrounded.
https://developer.android.com/preview/privacy/device-location#continuation-user-initiated-action
*Recommended Solution:*
We don't have to set "android:foregroundServiceType" in the "AndroidManifest.xml". We can set it dynamically via the new Android Q [Service.startForeground()](https://developer.android.com/reference/android/app/Service.html#startForeground(int,%20android.app.Notification,%20int)) method overload which accepts a
foregroundServiceType as a 3rd argument. We should modify Titanium's [Service.foregroundNotify()](https://docs.appcelerator.com/platform/latest/#!/api/Titanium.Android.Service-method-foregroundNotify) to support this new setting as well.
8_3_X: https://github.com/appcelerator/titanium_mobile/pull/11197
FR Passed, waiting on Jenkins build.
merged to master
Verified working correctly on 8.3.0. Ticket closed.
Build: 8.3.0.v20191002165629