PLUGPIN.Receiver

The receiver is the central object for using PlugPIN. It is the line between your app and the controlling user. The object has five getters (values you can read, but not write) and 12 methods. Most of those methods are ways to tell the receiver what to do when the controlling user performs an action. The way this works is through so-called 'callbacks'. A callback is a function that you can pass to the receiver. The receiver stores that function internally and sits on it until a certain event takes place. The receiver then calls that function, with predefined arguments.

All methods except destroy() return the receiver object, so methods calls can be chained.

To get a deeper understanding of which method you should use for your app, try the event debug tool.

Getters

Receiver.name
Returns the name of the receiver.

Receiver.notification
Returns the value of the notification parameter.

Receiver.status
Returns the status of the receiver. States are

  • initializing
    The receiver is trying to connect to the PlugPIN service
     
  • waiting
    The receiver is waiting for connection to the PlugPIN service.
     
  • connected
    The receiver is connected to the PlugPIN service.
     
  • attached
    The receiver is attached to a controller
     
  • error
    Something went wrong

Receiver.connectionCode
The code a user should enter on her smartphone to attach to your app. If you have set the 'showHelpText' parameter to 'none', you should communicate the connection code to the user yourself.

Receiver.screenName
The screen name of the user that is attached to this receiver. Will return null when no controller is attached.

 

Methods

onRegister( callback )
Callback is called when the Receiver has built a connection to the service. At this point the receiver will have a connectionCode and is ready for attachment.
more

onAttach( callback )
Callback is called when a Controller attaches to the Receiver. At this point the receiver can return the screen name of the controller.
more info

onDetach( callback )
Callback is called when the Receiver is detached from a previously attached Controller.
more info

onScreenNameChange( callback )
Callback is called when the controlling user changes her screen name
more info

onTap( callback )
Callback is called when the controlling user taps her screen. A tap is like a click on website.
more info

onCircle( callback )
Callback is called continuously while the controlling user makes a circular gesture on her screen
more info

onTouch( callback )
Callback is called continuously while the controlling user touches her screen
more info

onTouchEnd( callback )
Callback is called when the controlling user user stops touching her screen
more info

onOrientationChange( callback )
Callback is called when the controlling user changes the orientation of her device
more info

switchToURL( callback )
Load another PlugPIN and pass the currently attached controller to that app.
more info

detach()
Forcefully detaches the currently attached controller
more info

destroy()
Deletes the receiver.
more info

 

 

Contact us


Talk to us!
Tell us anything you want to and please add your contact information.




Our contact info
tel. +31 (0) 20 2170013
info@plugpin.com

Groenhoedenveem 28
1019 BL Amsterdam
The Netherlands

News letter


Enter your e-mail address to stay informed on everything PlugPIN!