I managed to solve this using the Bps tutorial provided by BlackBerry (https://developer.blackberry.com/native/documentation/cascades/device_platform/bps/bps_tutorial.html)
After some changes to the code, I achieved the results that I wanted. Thanks