New feature roundup: native confirm, loader and Android toasts UI, audio playback and new foreground camera module
You asked for more native UIs and we’ve delivered!
On top of that we’ve expanded on our native APIs by enhancing the media module for audio playback and adding a new foreground camera module for use with older Android versions where the file.getImage API doesn’t suffice.
We’ve had a much broader range of APIs in our core product than other hybrid platforms for a while – it’s not just about native features, but also UI components and cloud SDK integrations, as you can see from our features summary.
Here are the details:
Native confirm, loader and toast UIs
Available on both iOS and Android, we’ve added new native UI components in the notification module.
You can show and hide a native loader using forge.notification.showLoading and forge.notification.hideLoading:
forge.notification.showLoading("Please wait", "Video is loading...", function() {
//Success callback
}, function() {
//Error callback
});
You can prompt the user for confirmation using a customizable confirm UI with forge.notification.confirm:
forge.notification.confirm("Confirm your action", "Are you sure you to delete this item?", "Yes", "No",
function (userClickedYes) {
if (userClickedYes) {
// ... implement logic for when user clicked "Y"
} else {
// ... implement logic for when user clicked "N"
}
});
“Toasts” are small temporary popups which are great for giving your user unobtrusive feedback as they use your app. We’re pleased to now offer a toast API for Android and iOS: forge.notification.toast.
These features make it easier than ever to make your Trigger.io look and feel native since you can use actual native UI components rather than working on mimicking them in HTML5.
Audio playback
Our media module has had a native video playback API for a while.
And although it’s possible to achieve audio playback using HTML5 <audio> or <video> tags we’ve had many requests for more control over the audio player than HTML5 on its own can offer. So we’ve introduced native audio player controls with the forge.media.createAudioPlayer API.
forge.file.getLocal("music.mp3", function (file) {
forge.media.createAudioPlayer(file, function (player) {
player.play();
});
});
As well as the basic “play” method, the audio player has the usual “stop” and “pause” controls plus APIs to get the “duration”, “seek” a particular position in the track and listen for playback position changes with “positionChanged.addListener”.
Foreground camera module
Older Android versions can struggle with the memory requirements of the forge.file.getImage API which provides native camera access. To handle that, we’ve added a new foreground camera module to be used on Android only.
Unlike the file module this module displays the camera as part of your app. Although this means that the user will not have the option to select an image from the gallery, or perform advanced options such as zooming or changing other camera settings, on low memory devices this is a more reliable method of capturing a photo – it tends to be snappier too!
What’s next?
Follow us on Twitter or Facebook to see our latest news and updates.
Sign up now to take advantage of these new features or get in touch with us at anytime at support@trigger.io.















The Trigger.io team was in Berlin in February for 

