Skip to content

Commit

Permalink
feat(android): add camera/microphone foreground service constants (#1…
Browse files Browse the repository at this point in the history
…1986)

Fixes TIMOB-28051
  • Loading branch information
jquick-axway committed Oct 8, 2020
1 parent d8d442e commit 0e98584
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,10 @@ public class AndroidModule extends KrollModule
@Kroll.constant
public static final int FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION =
ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION;
@Kroll.constant
public static final int FOREGROUND_SERVICE_TYPE_MICROPHONE = ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE;
@Kroll.constant
public static final int FOREGROUND_SERVICE_TYPE_CAMERA = ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA;

protected RProxy r;
private LinkedList<BroadcastReceiverProxy> registeredBroadcastReceiverProxyList = new LinkedList<>();
Expand Down
162 changes: 148 additions & 14 deletions apidoc/Titanium/Android/Android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1827,65 +1827,199 @@ properties:
summary: |
A special value indicates to use all types set in manifest file.
description: |
See [ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MANIFEST).
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_MANIFEST](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MANIFEST)
documentation for more details.
type: Number
permission: read-only
since: "8.3.0"

- name: FOREGROUND_SERVICE_TYPE_NONE
summary: |
The default foreground service type if not been set in manifest file.
summary: The default foreground service type.
description: |
See [ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_NONE).
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_NONE](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_NONE)
documentation for more details.
type: Number
permission: read-only
since: "8.3.0"

- name: FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
summary: |
Constant corresponding to mediaPlayback in the R.attr.foregroundServiceType attribute. Music, video, news or other media playback.
Allows music, video, news or other media playback while the app is in the background.
description: |
See [ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK).
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
To use this constant, you must also set your `<service/>` element to the
`foregroundServieType` attribute value as shown below.
``` xml
<ti:app>
<android>
<services>
<service url="<YourService.js>" android:foregroundServiceType="mediaPlayback"/>
</services>
</android>
</ti:app>
```
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK)
documentation for more details.
type: Number
permission: read-only
since: "8.3.0"

- name: FOREGROUND_SERVICE_TYPE_PHONE_CALL
summary: |
Constant corresponding to phoneCall in the R.attr.foregroundServiceType attribute. Ongoing phone call or video conference.
Allows ongoing phone call or video conferencing access while the app is in the background.
description: |
See [ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_PHONE_CALL).
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
To use this constant, you must also set your `<service/>` element to the
`foregroundServieType` attribute value as shown below.
``` xml
<ti:app>
<android>
<services>
<service url="<YourService.js>" android:foregroundServiceType="phoneCall"/>
</services>
</android>
</ti:app>
```
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_PHONE_CALL)
documentation for more details.
type: Number
permission: read-only
since: "8.3.0"

- name: FOREGROUND_SERVICE_TYPE_LOCATION
summary: |
Constant corresponding to location in the R.attr.foregroundServiceType attribute. GPS, map, navigation location update.
Allows accessing location from the GPS, map, etc. while the app is in the background.
description: |
See [ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_LOCATION).
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
To use this constant, you must also set your `<service/>` element to the
`foregroundServieType` attribute value as shown below.
``` xml
<ti:app>
<android>
<services>
<service url="<YourService.js>" android:foregroundServiceType="location"/>
</services>
</android>
</ti:app>
```
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_LOCATION)
documentation for more details.
type: Number
permission: read-only
since: "8.3.0"

- name: FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE
summary: |
Constant corresponding to connectedDevice in the R.attr.foregroundServiceType attribute. Auto, bluetooth, TV or other devices connection, monitoring and interaction.
Allows connecting to Android Auto, bluetooth, TV or other devices while app is in the background.
description: |
See [ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE).
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
To use this constant, you must also set your `<service/>` element to the
`foregroundServieType` attribute value as shown below.
``` xml
<ti:app>
<android>
<services>
<service url="<YourService.js>" android:foregroundServiceType="connectedDevice"/>
</services>
</android>
</ti:app>
```
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE)
documentation for more details.
type: Number
permission: read-only
since: "8.3.0"

- name: FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
summary: |
Constant corresponding to mediaProjection in the R.attr.foregroundServiceType attribute. Managing a media projection session, e.g for screen recording or taking screenshots.
Allows managing a media projection session for screen recording or taking screenshots
while app is in the background.
description: |
See [ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION in the Android API Reference](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION).
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
To use this constant, you must also set your `<service/>` element to the
`foregroundServieType` attribute value as shown below.
``` xml
<ti:app>
<android>
<services>
<service url="<YourService.js>" android:foregroundServiceType="mediaProjection"/>
</services>
</android>
</ti:app>
```
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION)
documentation for more details.
type: Number
permission: read-only
since: "8.3.0"

- name: FOREGROUND_SERVICE_TYPE_MICROPHONE
summary: Allows the microphone to be used while the app is in the background.
description: |
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
To use this constant, you must also set your `<service/>` element to the
`foregroundServieType` attribute value as shown below.
``` xml
<ti:app>
<android>
<services>
<service url="<YourService.js>" android:foregroundServiceType="microphone"/>
</services>
</android>
</ti:app>
```
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_MICROPHONE)
documentation for more details.
type: Number
permission: read-only
since: "9.3.0"

- name: FOREGROUND_SERVICE_TYPE_CAMERA
summary: Allows the camera to be used while the app is in the background.
description: |
This constant is passed to the <Titanium.Android.Service.foregroundNotify> method.
To use this constant, you must also set your `<service/>` element to the
`foregroundServieType` attribute value as shown below.
``` xml
<ti:app>
<android>
<services>
<service url="<YourService.js>" android:foregroundServiceType="camera"/>
</services>
</android>
</ti:app>
```
See Google's [ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA](https://developer.android.com/reference/android/content/pm/ServiceInfo.html#FOREGROUND_SERVICE_TYPE_CAMERA)
documentation for more details.
type: Number
permission: read-only
since: "9.3.0"

- name: FLAG_AUTO_CANCEL
summary: Cancel the notification when it is clicked by the user.
description: |
Expand Down

0 comments on commit 0e98584

Please sign in to comment.