Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

New Contributor
Posts: 2
Registered: ‎02-18-2013
My Device: bb 10
My Carrier: telenor

How to use Media key watcher ?



is there anyone who can help me how to use MediakeyWatcher, its same like in java Media action api we override MediaAction method and can perform whatever we want on media key press like PlayPuse, but i am new to C++.


i want to perform some action when someone press PlayPuse Media button on device


here what i found on BB Docs

QObject::connect(&keyWatcher, SIGNAL(longPress(bb::multimedia::MediaKey::Type)), this, SLOT(onLongPress());
QObject::connect(&keyWatcher, SIGNAL(shortPress(bb::multimedia::MediaKey::Type)), this, SLOT(onShortPress());
but i dont know how to use it, please help me with example