| CLASS info |
| public class Policy extends AbstractSafeParcelable |
| Describes a set of policies for publishing or subscribing to messages. |
| Type | Name | Desc |
| Class | Policy.Builder | Represents the builder class for Policy. |
| Type | Name | Desc |
| int | POLICY_FINDING_MODE_BROADCAST | To discover nearby devices, broadcasts a sharing code for other devices to scan. |
| int | POLICY_FINDING_MODE_SCAN | To discover nearby devices, scans for other devices’ sharing codes. |
| int | POLICY_FINDING_MODE_DEFAULT | To discover nearby devices, broadcasts a sharing code and scans for other devices’ sharing codes. |
| int | POLICY_DISTANCE_TYPE_DEFAULT | Allows messages to be transmitted over any distance. |
| int | POLICY_DISTANCE_TYPE_EARSHOT | Allows messages to be transmitted only within the earshot. |
| int | POLICY_TTL_SECONDS_DEFAULT | Default TTL, in seconds. |
| int | POLICY_TTL_SECONDS_INFINITE | Indefinite TTL, in seconds. |
| int | POLICY_TTL_SECONDS_MAX | Maximum TTL, in seconds. |
| Type | Name | Desc |
| public static final Policy | BLE_ONLY | Uses only BLE to discover nearby devices. The policy adopts TTL_SECONDS_INFINITE as the TTL and supports only #Get. |
| public static final Creator | CREATOR | |
| public static final Policy | DEFAULT | Default policy, which is applicable to most apps. Currently, the default policy executes both broadcasting and scanning and uses Bluetooth to discover nearby devices, regardless of the distance. |
| Return | Method |
| boolean | equals(Object other) Checks whether any other object is the same as this object. |
| int | hashCode() Obtains the hash value. |
| String | toString() Converts an object into a readable character string. |
| void | writeToParcel(Parcel dest, int flags) Writes this value into a dest parcel. |
| Constant |
| public static final int POLICY_FINDING_MODE_BROADCAST |
| To discover nearby devices, broadcasts a sharing code for other devices to scan. Constant value: 1 |
| Constant |
| public static final int POLICY_FINDING_MODE_SCAN |
| To discover nearby devices, broadcasts a sharing code and scans for other devices’ sharing codes. Constant value: 2 |
| Constant |
| public static final int POLICY_FINDING_MODE_DEFAULT |
| To discover nearby devices, scans for other devices’ sharing codes. Constant value: 0 |
| Constant |
| public static final int POLICY_DISTANCE_TYPE_DEFAULT |
| Allows messages to be transmitted over any distance. Constant value: 0 |
| Constant |
| public static final int POLICY_DISTANCE_TYPE_EARSHOT |
| Allows messages to be transmitted only within the earshot. Constant value: 1 |
| Constant |
| public static final int POLICY_TTL_SECONDS_DEFAULT |
| Default TTL, in seconds. Constant value: 240 |
| Constant |
| public static final int POLICY_TTL_SECONDS_INFINITE |
| Indefinite TTL, in seconds. Note that only #Get supports this TTL type now. Constant value: 0x7FFFFFFF |
| Constant |
| public static final int POLICY_TTL_SECONDS_MAX |
| Maximum TTL, in seconds. Constant value: 86400 |
| Method |
| public boolean equals(Object other) |
| Checks whether any other object is the same as this object. |
Parameters
| Parameter name | Parameter desc |
| other | Other object. |
| Method |
| public int hashCode() |
| Obtains the hash value. |
| Method |
| public String toString() |
| Converts an object into a readable character string. |
| Method |
| public void writeToParcel(Parcel dest, int flags) |
| Writes this value into a dest parcel. |
Parameters
| Parameter name | Parameter desc |
| dest | Parcel to which this object is written. |
| flags | Writing mode. |