NativeScript eases cross-platform app development for music app

Credit: Techtarget

Credit: Techtarget

ShoutOutPlay is a mobile app built with NativeScript that lets users record personal dedications and attach them to music tracks that play in Spotify. In this podcast, developer and ShoutOutPlay creator Nathan Walker discusses his choice of NativeScript for cross-platform app development to yield native iOS and Android apps from a single code base. He also explains how the app links and syncs with Spotify and shares what he learned and how it can benefit other developers of cloud-based mobile apps.

To use ShoutOutPlay, users record a message (called a shout out), attach it to any track from Spotify and add it to a playlist. As the song plays, its volume drops and the shout out is mixed in and heard clearly. After the shout out plays, the song resumes playing at its normal volume. Frivolous fun, perhaps, but dead serious when it comes to application development.

ShoutOutPlay could not have been built on the web,” says Walker, “because it uses Spotify, which allows only 30-second previews of tracks on the web. I had to use the native SDK in order to integrate with Spotify.” The app was built as a test using the NativeScript cross-platform app development framework.

Walker’s day job is as a senior software engineer at Infowrap in Portland, Ore. Infowrap is a software as a service application that allows users working on projects to collect, organize and share different kinds of content with other collaborators. Walker is investigating using NativeScript’s cross-platform app development capabilities in future versions of Infowrap.

Link and sync

The first step to using the ShoutOutPlay app is recording the shout out greeting as an .M4A file on an iOS or Android device. The second step is more complex — linking the separate shout out and music files together. To do that, another tool is required.

“I integrated [Google] Firebase into this NativeScript application,” says Walker. Each shout out is recorded locally on the phone and then synced and backed up to a Firebase database. Walker called an API from Spotify to access the streaming service’s full music player.

The choice of NativeScript as a cross-platform app development platform came about as Infowrap researched moving its platform from a hybrid Apache Cordova app to a true native app, Walker says. “I was trying to find something where we didn’t have a pure Objective-C or Java app because of the time involved.”

As an experiment, Walker wrote several plug-ins in NativeScript that found their way into production. ShoutOutPlay uses 16 plug-ins, all of which passed app store scrutiny from Apple and Google. Only one issue popped up: Spotify’s spotty support for IPv6.

Ultimately, Walker chose NativeScript because developers can write both iOS and Android UIs with one single, concise XLM language, he says. “If you have ever looked at an Apple app versus an Android app and looked at the UI construction, they’re not the same at all.”

In the remainder of this podcast, Walker discusses using NativeScript to leverage Angular 2, avoiding Objective-C and Java code and sticking with JavaScript. He also comments on the profound changes wrought by Angular 2 compared with its predecessor, including its ability to be used with multiple platforms.

The ShoutOutPlay mobile app is available in the Apple App Storeand on Google Play.