Ti.Bump Module

Description

A module supporting Bump(TM) functionality for your app. This allows devices to communicate when they are tapped together.

WARNING

You MUST copy the contents of the "Resources" in the bump module's zip to your project's "Resources" folder manually before running this demo!

Accessing the bump Module

To access this module from JavaScript, you would do the following:

Titanium.Bump = Ti.Bump = require("ti.bump");

Methods

Ti.Bump.connect

Opens up the bump dialog, asking the user to bump two devices together.

Arguments

Takes one argument, a dictionary with keys:

Fires the event "ready" after the dialog shows up, and "connected" after connecting to another device.

Ti.Bump.disconnect

Stop listening for connections.

Ti.Bump.sendMessage

Sends a message via Bump(TM). Only utilize this after the "connected" event fires, and before the "disconnected" event fires.

Arguments

Takes one argument, a string. If the message fails to send, the "error" event fires.

Events

ready

Event indicating that Bump(TM) is ready for connections.

error

Event indicating an error occurred. Has one property, "message", which is the error message.

connected

Event indicating that there is a connection to another device. Has one property, "username", which is the username of the other device.

disconnected

Event indicating that the connection ended. Has one property, "message", which is one of:

error

Event indicating there was an error with the connection. Has one property, "message", which is one of:

cancel

Event indicating the user cancelled the connection. Has one property, "message", which always has the value "FAILUSERCANCELED".

data

A message was transmitted between devices over the connection. Has one property, "data", which is a blob of type "text/plain" that holds text.

Usage

See example.js

Author

Jeff Haynie jhaynie@appcelerator.com, Appcelerator Inc.

License

Copyright(c) 2010-2011 by Appcelerator, Inc. All Rights Reserved. Please see the LICENSE file included in the distribution for further details.