How to get Siri Suggested playlist/song above Now playing for Music apps like Apple music and Resso when airpods are connected

178 views Asked by At

Now playing Screenshot when Airpods are connected

When Airpods are connected and there is no music already playing Siri suggests a playlist/songs above the Now Playing widget for the Apple Music app & Resso.

This is probably due to Siri's "Show When listening" suggestions as when I turn it off then it doesn't come any longer.

I have also tried this in my project by donating songs and suggesting songs. But still, it is not coming for me. The code that I have used is below:

var inImage: INImage?
 
if let cResource = ImageTask.sharedTask.cachedResource(item: song, requiredType: ImageType.small, thumborUrlForRequiredType: nil, lookOnDisk: true) {
    let imageData = cResource.image!.jpegData(compressionQuality: 0.9)
    inImage = INImage(imageData: imageData!)
}

let item = INMediaItem(identifier: song.id, title: song.title, type: .song, artwork: inImage, artist: song.artistTitle)
let intentItem = INPlayMediaIntent(mediaContainer: item)
let set = NSOrderedSet(array: [intentItem])

INUpcomingMediaManager.shared.setSuggestedMediaIntents(set)
           
let interaction = INInteraction(intent: intentItem, response: nil)
interaction.groupIdentifier = "in.myapp"
interaction.donate { (error) in
     if error != nil {
       Log.logDebug(message: "&*&*&*&*&*&*&*&*&*&*&*&*: failure, \(String(describing: intent.mediaContainer?.title))")
     }else {
       Log.logDebug(message: "&*&*&*&*&*&*&*&*&*&*&*&*: success, \(String(describing: intent.mediaContainer?.title))")
     }
 }


0

There are 0 answers