startKeepAlive


Purpose

Starts a foregrounding service which increases the process prority to prevent AMP Hybrid Client from being killed by the Android operating system, e.g when the user is gathering data to be entered in a form.

Once started, the foreground service can be stopped using the stopKeepAlive method.

Under normal operating conditions, the foregrounding service starts automatically once an external activity is opened, which reduces a risk of the client being terminated. When this happens, the following notification is displayed: “Waiting for an external action to finish". After returning to the client, the service closes.

On iOS, this method has no effect.

Signature

startKeepAlive( message, timeout )

Returns

This method does not return anything.

Parameter

Name Description Type Use
message Includes a message to be displayed in the device's notification area. string required
timeout

Sets a time after which the foreground service is automatically terminated (in seconds). Calling the startKeepAlive method while setting the timeout to various values results in different behavior of the foreground service:

  • 0 results in not starting the foreground service

  • negative value results in starting the foreground service for an indefinite time.

integer optional

Related topics

Public API reference
Container
Legal notice | Copyright © 2017 and Confidential to Pegasystems Inc. All rights reserved
PDN | Feedback
Advanced...