0

Is it possible to enable sharing listening activity with Facebook from the Spotify API?

SPSession seems to have functions around scrobbling:

-(void)setScrobblingState:(sp_scrobbling_state)state forService:(sp_social_provider)service callback:(SPErrorableOperationCallback)block;

If not, is it possible to know if a user has enabled sharing to Facebook?

Edit: Thanks for the answer! Looks like there's an enum sp_social_provider that has a possible value SP_SOCIAL_PROVIDER_FACEBOOK for use with the following functions:

setScrobblingUserName:password:forService:callback:
setScrobblingState:forService:callback:
Mark
  • 39,169
  • 11
  • 42
  • 48

1 Answers1

1

You can use SPSession's fetchScrobblingStateForService:callback: to find out if scrobbling to a particular service is enabled.

To enable scribbling if it isn't enabled, you need to call setScrobblingUserName:password:forService:callback: to set credentials for the service, then setScrobblingState:forService:callback: to enable it.

Set the state to SP_SCROBBLING_STATE_USE_GLOBAL_SETTING to keep the user's global preferences in your session (which is preferred).

iKenndac
  • 18,730
  • 3
  • 35
  • 51
  • Thanks! Just to confirm, in the case of Facebook, username would be the Facebook account email? What would I pass to `forService`? – Mark Feb 05 '14 at 14:59
  • Have a look in api.h in libspotify for definitions of all the social services and scrobbling states. – iKenndac Feb 05 '14 at 15:36