public final class PebbleKit
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
PebbleKit.FirmwareVersionInfo |
static class |
PebbleKit.PebbleAckReceiver
A special-purpose BroadcastReceiver that makes it easy to handle 'RECEIVE_ACK' intents broadcast from pebble
.apk.
|
static class |
PebbleKit.PebbleDataLogReceiver
A special-purpose BroadcastReceiver that makes it easy to handle 'DATA_AVAILABLE' data logging intents broadcast from pebble.apk.
|
static class |
PebbleKit.PebbleDataReceiver
A special-purpose BroadcastReceiver that makes it easy to handle 'RECEIVE' intents broadcast from pebble.apk.
|
static class |
PebbleKit.PebbleNackReceiver
A special-purpose BroadcastReceiver that makes it easy to handle 'RECEIVE_NACK' intents broadcast from pebble
.apk.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
areAppMessagesSupported(android.content.Context context)
Synchronously query the Pebble application to see if the connected watch is running a firmware version that
supports PebbleKit messages.
|
static void |
closeAppOnPebble(android.content.Context context,
java.util.UUID watchappUuid)
Send a message to the connected Pebble to close an application identified by a UUID.
|
static void |
customizeWatchApp(android.content.Context context,
Constants.PebbleAppType appType,
java.lang.String name,
android.graphics.Bitmap icon)
Send a message to the connected Pebble to "customize" a built-in PebbleKit watch-app.
|
static PebbleKit.FirmwareVersionInfo |
getWatchFWVersion(android.content.Context context)
Get the version information of the firmware running on a connected watch.
|
static boolean |
isDataLoggingSupported(android.content.Context context)
Synchronously query the Pebble application to see if the connected watch is running a firmware version that
supports PebbleKit data logging.
|
static boolean |
isWatchConnected(android.content.Context context)
Synchronously query the Pebble application to see if an active Bluetooth connection to a watch currently exists.
|
static android.content.BroadcastReceiver |
registerDataLogReceiver(android.content.Context context,
PebbleKit.PebbleDataLogReceiver receiver)
A convenience function to assist in programatically registering a broadcast receiver for the 'DATA_AVAILABLE'
intent.
|
static android.content.BroadcastReceiver |
registerPebbleConnectedReceiver(android.content.Context context,
android.content.BroadcastReceiver receiver)
A convenience function to assist in programatically registering a broadcast receiver for the 'CONNECTED' intent.
|
static android.content.BroadcastReceiver |
registerPebbleDisconnectedReceiver(android.content.Context context,
android.content.BroadcastReceiver receiver)
A convenience function to assist in programatically registering a broadcast receiver for the 'DISCONNECTED'
intent.
|
static android.content.BroadcastReceiver |
registerReceivedAckHandler(android.content.Context context,
PebbleKit.PebbleAckReceiver receiver)
A convenience function to assist in programatically registering a broadcast receiver for the 'RECEIVE_ACK'
intent.
|
static android.content.BroadcastReceiver |
registerReceivedDataHandler(android.content.Context context,
PebbleKit.PebbleDataReceiver receiver)
A convenience function to assist in programatically registering a broadcast receiver for the 'RECEIVE' intent.
|
static android.content.BroadcastReceiver |
registerReceivedNackHandler(android.content.Context context,
PebbleKit.PebbleNackReceiver receiver)
A convenience function to assist in programatically registering a broadcast receiver for the 'RECEIVE_NACK'
intent.
|
static void |
requestDataLogsForApp(android.content.Context context,
java.util.UUID appUuid)
A convenience function to emit an intent to pebble.apk to request the data logs for a particular app.
|
static void |
sendAckToPebble(android.content.Context context,
int transactionId)
Send a message to the connected watch acknowledging the receipt of a PebbleDictionary.
|
static void |
sendDataToPebble(android.content.Context context,
java.util.UUID watchappUuid,
PebbleDictionary data)
Send one-or-more key-value pairs to the watch-app identified by the provided UUID.
|
static void |
sendDataToPebbleWithTransactionId(android.content.Context context,
java.util.UUID watchappUuid,
PebbleDictionary data,
int transactionId)
Send one-or-more key-value pairs to the watch-app identified by the provided UUID.
|
static void |
sendNackToPebble(android.content.Context context,
int transactionId)
Send a message to the connected watch that the previously sent PebbleDictionary was not received successfully.
|
static void |
startAppOnPebble(android.content.Context context,
java.util.UUID watchappUuid)
Send a message to the connected Pebble to launch an application identified by a UUID.
|
public static void customizeWatchApp(android.content.Context context, Constants.PebbleAppType appType, java.lang.String name, android.graphics.Bitmap icon) throws java.lang.IllegalArgumentException
context
- The context used to send the broadcast. (Protip: pass in the ApplicationContext here.)appType
- The watch-app to be configured. Options are eithername
- The custom name to be applied to the watch-app. Names must be less than 32 characters in length.icon
- The custom icon to be applied to the watch-app. Icons must be black-and-white bitmaps no larger than 32px
in either dimension.java.lang.IllegalArgumentException
- Thrown if the specified name or icon are invalid. Constants.PebbleAppType.SPORTS
or Constants.PebbleAppType.GOLF
.public static boolean isWatchConnected(android.content.Context context)
context
- The Android context used to perform the query.
Protip: You probably want to use your ApplicationContext here.public static boolean areAppMessagesSupported(android.content.Context context)
context
- The Android context used to perform the query.
Protip: You probably want to use your ApplicationContext here.public static PebbleKit.FirmwareVersionInfo getWatchFWVersion(android.content.Context context)
context
- The Android context used to perform the query.
Protip: You probably want to use your ApplicationContext here.public static boolean isDataLoggingSupported(android.content.Context context)
context
- The Android context used to perform the query.
Protip: You probably want to use your ApplicationContext here.public static void startAppOnPebble(android.content.Context context, java.util.UUID watchappUuid) throws java.lang.IllegalArgumentException
context
- The context used to send the broadcast.watchappUuid
- A UUID uniquely identifying the target application. UUIDs for the stock PebbleKit applications are
available in Constants
.java.lang.IllegalArgumentException
- Thrown if the specified UUID is invalid.public static void closeAppOnPebble(android.content.Context context, java.util.UUID watchappUuid) throws java.lang.IllegalArgumentException
context
- The context used to send the broadcast.watchappUuid
- A UUID uniquely identifying the target application. UUIDs for the stock kit applications are available in
Constants
.java.lang.IllegalArgumentException
- Thrown if the specified UUID is invalid.public static void sendDataToPebble(android.content.Context context, java.util.UUID watchappUuid, PebbleDictionary data) throws java.lang.IllegalArgumentException
context
- The context used to send the broadcast.watchappUuid
- A UUID uniquely identifying the target application. UUIDs for the stock kit applications are available in
Constants
.data
- A dictionary containing one-or-more key-value pairs. For more information about the types of data that
can be stored, see PebbleDictionary
.java.lang.IllegalArgumentException
- Thrown in the specified PebbleDictionary or UUID is invalid.public static void sendDataToPebbleWithTransactionId(android.content.Context context, java.util.UUID watchappUuid, PebbleDictionary data, int transactionId) throws java.lang.IllegalArgumentException
context
- The context used to send the broadcast.watchappUuid
- A UUID uniquely identifying the target application. UUIDs for the stock kit applications are available in
Constants
.data
- A dictionary containing one-or-more key-value pairs. For more information about the types of data that
can be stored, see PebbleDictionary
.transactionId
- An integer uniquely identifying the transaction. This can be used to correlate messages sent to the
Pebble and ACK/NACKs received from the Pebble.java.lang.IllegalArgumentException
- Thrown in the specified PebbleDictionary or UUID is invalid.public static void sendAckToPebble(android.content.Context context, int transactionId) throws java.lang.IllegalArgumentException
context
- The context used to send the broadcast.transactionId
- The transaction id of the message in which the data was received. Valid transaction IDs are between (0,
255).java.lang.IllegalArgumentException
- Thrown if an invalid transaction id is specified.public static void sendNackToPebble(android.content.Context context, int transactionId) throws java.lang.IllegalArgumentException
context
- The context used to send the broadcast.transactionId
- The transaction id of the message in which the data was received. Valid transaction IDs are between (0,
255).java.lang.IllegalArgumentException
- Thrown if an invalid transaction id is specified.public static android.content.BroadcastReceiver registerPebbleConnectedReceiver(android.content.Context context, android.content.BroadcastReceiver receiver)
Activity.onPause()
method.context
- The context in which to register the BroadcastReceiver.receiver
- The receiver to be registered.Constants.INTENT_PEBBLE_CONNECTED
public static android.content.BroadcastReceiver registerPebbleDisconnectedReceiver(android.content.Context context, android.content.BroadcastReceiver receiver)
Activity.onPause()
method.context
- The context in which to register the BroadcastReceiver.receiver
- The receiver to be registered.Constants.INTENT_PEBBLE_DISCONNECTED
public static android.content.BroadcastReceiver registerReceivedDataHandler(android.content.Context context, PebbleKit.PebbleDataReceiver receiver)
Activity.onPause()
method.context
- The context in which to register the BroadcastReceiver.receiver
- The receiver to be registered.Constants.INTENT_APP_RECEIVE
public static android.content.BroadcastReceiver registerReceivedAckHandler(android.content.Context context, PebbleKit.PebbleAckReceiver receiver)
Activity.onPause()
method.context
- The context in which to register the BroadcastReceiver.receiver
- The receiver to be registered.Constants.INTENT_APP_RECEIVE_ACK
public static android.content.BroadcastReceiver registerReceivedNackHandler(android.content.Context context, PebbleKit.PebbleNackReceiver receiver)
Activity.onPause()
method.context
- The context in which to register the BroadcastReceiver.receiver
- The receiver to be registered.Constants.INTENT_APP_RECEIVE_NACK
public static android.content.BroadcastReceiver registerDataLogReceiver(android.content.Context context, PebbleKit.PebbleDataLogReceiver receiver)
Activity.onPause()
method.context
- The context in which to register the BroadcastReceiver.receiver
- The receiver to be registered.Constants.INTENT_DL_RECEIVE_DATA
public static void requestDataLogsForApp(android.content.Context context, java.util.UUID appUuid)
Activity.onPause()
method.context
- The context in which to register the BroadcastReceiver.appUuid
- The app for which to request data logs.Constants.INTENT_DL_RECEIVE_DATA
,
Constants.INTENT_DL_REQUEST_DATA