WebAPI/Inter App Communication Alt proposal: Difference between revisions

Line 97: Line 97:
* display information about the currently played track from the Gaia Music app or any other 3rd party music privileged app.
* display information about the currently played track from the Gaia Music app or any other 3rd party music privileged 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 'connections' field to its manifest
  {
  {
     'name': 'System',
     'name': 'System',
     /* ... */
     /* ... */
     'connect': {
     'connections': {
       'musictrack': {
       'musictrack': {
         'description': 'Show the currently played music track information in the lockscreen'
         'description': 'Show the currently played music track information in the lockscreen'
Line 114: Line 114:
     'name': 'Music', (or Songbirdy or iTunos)     
     'name': 'Music', (or Songbirdy or iTunos)     
     /* ... */
     /* ... */
     'connect': {
     'connections': {
       'musicremotecontrol': {
       'musicremotecontrol': {
         'description': 'Play, pause and stop music tracks'
         'description': 'Play, pause and stop music tracks'
Line 158: Line 158:
The user allows the connection and a system message is sent to the lockscreen. The lockscreen only allows connections with privileged apps, so it checks that in the connection request handler, and set a handler for the messages sent through the MessagePort via ''MessagePort.onmessage''
The user allows the connection and a system message is sent to the lockscreen. The lockscreen only allows connections with privileged apps, so it checks that in the connection request handler, and set a handler for the messages sent through the MessagePort via ''MessagePort.onmessage''


  navigator.setMessageHandler('connect', function(connectionRequest) {
  navigator.setMessageHandler('connection', function(connectionRequest) {
   if (connectionRequest.keyword !== 'musictrack') {
   if (connectionRequest.keyword !== 'musictrack') {
     return;
     return;
Confirmed users
110

edits