Wp dev day_using_the_nokia_music_apis

Post on 01-Nov-2014

475 views 2 download

Tags:

description

 

Transcript of Wp dev day_using_the_nokia_music_apis

USING THE NOKIA MUSIC C# API ON WINDOWS PHONE 8 / WINDOWS 8 Steve Robbins Chief Architect Nokia Music

AGENDA What is Nokia Music?

Introduction to App-to-App and using our App-to-App APIs

Using our C# API to add music data to your app.

NOKIA MUSIC Instant free music streaming on Lumia Windows Phones. 100s of curated mixes Create your own artist mixes Offline caching Graphic Equalizer Personalised Notifications No login, no ads

Also on Windows 8, S40 and Web.

NOKIA MUSIC APP-TO-APP APIS Nokia Music for Windows Phone 8 and Windows 8 include App-to-App APIs

NOKIA MUSIC APP-TO-APP APIS

App-to-App protocols allow one app to launch another with a specific URI scheme.  Launcher.LaunchUriAsync(  "nokia-­‐music://show/artist/?name=    Rihanna")  

NOKIA MUSIC APP-TO-APP APIS

Show Product Details – e.g. an album nokia-­‐music://show/product/?id={id}  

Launch App nokia-­‐music://  

Search MP3 store nokia-­‐music://search/anything/?term={term}  

Show Artist Details nokia-­‐music://show/artist/?name={name}  

Play an Artist Mix nokia-­‐music://play/artist/?artist={name}  

Show Gigs Around You nokia-­‐music://show/gigs/  

Search for Gigs nokia-­‐music://search/gigs/?term={term}  

Show Curated Mixes nokia-­‐music://show/mixes/  

Play a Curated Mix nokia-­‐music://play/mix/?id={id}  

DEMOS Create App that Launches Nokia Music

Extend App to search for music

Benefits of App-to-App – Social Networks, NFC

ProximityDevice  device  =  ProximityDevice.GetDefault();  if  (device  !=  null)  {        device.PublishBinaryMessage("WindowsUri:WriteTag",                GetBufferFromUrl("nokia-­‐music://play/mix/?id=35541874"),                UnregisterUponSend);        MessageBox.Show("Tap  NFC  tag  to  write  link");  }    See http://nokia.ly/nfcslides

APP-TO-APP AND NFC

Lots of apps support App-To-App!… http://nokia.ly/ wpapptoapp

APP-TO-APP SCHEMES

If you want to learn how to implement app-to-app, watch our //build/ 2012 talk at 14mins-22mins http://nokia.ly/ buildmusicapi

APP-TO-APP IMPLEMENTATION

LAUNCHER TASKS

new  ShowArtistTask()  {  

   ArtistName  =  "Green  Day"  

}.Show();  

void  Launch(Uri  appToAppUri,  Uri  webFallbackUri)  {      #if  WINDOWSPHONE8      if  (IsNokiaDevice())      {          Launcher.LaunchUriAsync(appToAppUri);          return;      }      #endif      WebBrowserTask  web  =  new  WebBrowserTask();      web.Uri  =  webFallbackUri;      web.Show();  }  

WEB FALL-BACK

LAUNCHER TASKS Launch App new  LaunchTask().Show();

Search MP3 store new  MusicSearchTask()  {              SearchTerms  =  "Rihanna"  }.Show();

Show Artist Details new  ShowArtistTask()  {                  ArtistName  =  "Green  Day”  }.Show();

Play an Artist or Curated Mix new  PlayMixTask()  {  

ArtistName  =  "Green  Day"  }.Show();

Show Gigs Around You or Search for Gigs new  ShowGigsTask().Show();

Show Curated Mixes new  ShowMixesTask().Show();

DEMOS API installation with NuGet

Take an existing Location-based app and add “Gigs Near You” feature

NOKIA MUSIC C# API Makes it easy for you to integrate music data into your app.  MusicClient  api  =  

                 new  MusicClient(ClientId);  

var  artists  =            await  api.GetTopArtistsAsync();  

list.ItemsSource  =  artists.Result;  

//  when  user  selects  artist...    

artist.PlayMix();    

NOKIA MUSIC C# API Search var  items  =  await  api.SearchAsync("Green  Day");  Search Artist By Location var  a  =  await  api.GetArtistsAroundLocationAsync(51.4,-­‐2.6);

Get Search Suggestions var  a  =  await  api.GetSearchSuggestionsAsync("Poker");

Get available genres var  g  =  await  api.GetGenresAsync(); Get top artists in genre var  a  =  await  api.GetTopArtistsForGenreAsync(myGenre);  Get top products in genre var  p  =  await  api.GetTopProductsForGenreAsync(myGenre); Get new releases in genre var  a  =  await  api.GetNewReleasesForGenreAsync(myGenre);  

Get Artist Suggestions var  a  =  await  api.GetArtistSearchSuggestionsAsync("Green");

Get charts var  p  =  await  api.GetTopProductsAsync(Category.Album);

Get a list of new releases var  p  =  await  api.GetNewReleasesAsync(Category.Track); Get the top artists var  a  =  await  api.GetTopArtistsAsync();  

NOKIA MUSIC C# API Get products by an artist var  p  =  await  api.GetArtistProductsAsync(myArtist);  

Get available Mix Groups var  g  =  await  api.GetMixGroupsAsync(); Get Mixes for a group var  m  =  await  api.GetMixesAsync(myMixGroup);

Get similar artists var  a=  await  api.GetSimilarArtistsAsync(myArtist); Get similar products var  p  =  await  api.GetSimilarProductsAsync(product);

DEMOS Sign up for API Keys

Create application to show artists on map

USER DATA ACCESS Version 3.x allows easy access to user data: •  Encapsulates OAuth2 flow. •  Handles token caching and renewal. •  User is in complete control.

var  result  =          await  AuthenticateUserAsync(…);

 

USER DATA ACCESS Get Play History var  items  =  await  api.GetUserPlayHistoryAsync();  Get Top Artists var  items  =  await  api.GetUserTopArtistsAsync();

DEMOS An application that creates wallpaper from recent playback

Source and examples: http://nokia.ly/wpmusicapi

Contact @sr_gb

SUMMARY