WebAPI/Inter App Communication Alt proposal: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 93: Line 93:
(Disclaimer: this is just a rough example of a possible solution for this use case. This can probably be done with an unique keyword and an agreed bidirectional API, but I wanted a wider example)
(Disclaimer: this is just a rough example of a possible solution for this use case. This can probably be done with an unique keyword and an agreed bidirectional API, but I wanted a wider example)


The lockscreen wants to be able to control the music played by the Gaia Music app or any other 3rd party music app and also wants to display information about the currently played track from any of these music apps if they are
The lockscreen wants to be able to control the music played by the Gaia Music app and also wants to display information about the currently played track from the Gaia Music app or any other 3rd party music app.


In order to receive information about the currently played music track, the System app needs to add the following 'connect' field to its manifest
In order to receive information about the currently played music track, the System app needs to add the following 'connect' field to its manifest
Line 165: Line 165:
=== Music controls in the lockscreen ===
=== Music controls in the lockscreen ===


Assuming that the three example music apps are installed, once the lockscreen is ready it sends a connection request of this kind:
Assuming that the three example music apps mentioned above are installed, once the lockscreen is ready it sends a connection request of this kind:


  connect('musicremotecontrol').then(function onConnectionAccepted(ports) {
  connect('musicremotecontrol').then(function onConnectionAccepted(ports) {
    
   ...
  }, function onConnectionRejected(reason) {
  }, function onConnectionRejected(reason) {
    
   ...
  });
  });


meaning that the lockscreen wants to connect


'''TODO'''
'''TODO'''
Confirmed users
483

edits

Navigation menu