PassLibrary Object
The PassLibrary Object represents the library of passes. It provides an interface to the user’s library of passes.
Here is an example for creating a PassLibrary with callbacks:
var passLibrary1 = new com.kony.PassLibrary();
Return Value
Object - com.kony.PassLibrary
Methods
The com.kony.PassLibrary class contains the following methods.
Presents UI to add pass.
If the status is KonyPKPassLibraryShouldReviewPasses in completionCallback, present an instance of com.kony.AddPassesViewController with the same pass, to let the user review and add them.
Syntax
<<PassObject>>.addPassWithCompletionCallback(pass, completionCallback);
Input Parameters
Parameter | Description |
---|---|
pass [Object] - com.kony.Pass - Mandatory | The pass being added. |
completionCallback [Function] - Mandatory |
The completion callback called after the user.
|
Example
passbook1.addPassWithCompletionCallback(pass, completionCallback);
Return Values
None
Platform Availability
- iOS
Presents UI to add multiple passes.
If the status is KonyPKPassLibraryShouldReviewPasses in completionCallback, present an instance of com.kony.AddPassesViewController with the same pass, to let the user review and add them.
Syntax
<<PassObject>>.addPassesWithCompletionCallback();
Input Parameters
Example
passbook1.addPassWithCompletionCallback(passes, completionCallback);
Return Values
Number
Platform Availability
- iOS
Returns whether the user’s pass library contains a pass. This method lets you determine that the pass library contains a pass even though your app wouldn’t be able to read or modify the pass.
Syntax
<<PassObject>>.containsPass();
Input Parameters
Parameter | Description |
---|---|
pass [Object] - com.kony.Pass - Mandatory | The pass being queried. |
Example
passbook1.addPassWithCompletionCallback(passes, completionCallback); ... var passbook1 = passbook1.addPassWithCompletionCallback(passes, completionCallback);
Return Values
Return Value | Description |
---|---|
Boolean | True if pass is in the PassLibrary. |
Platform Availability
- iOS
The proximity value gives a general sense of the relative distance to the beacon. Use it to quickly identify beacons that are nearer to the user rather than farther away.
Syntax
<<PassObject>>.getPassWithTypeIdentifierAndSerialNumber(identifier, serailNumber);
Input Parameters
Parameter | Description |
---|---|
identifier [String] - Mandatory | The pass’s pass type identifier. |
serailNumber [String] | The pass’s serial number. |
Example
passbook1.getPassWithTypeIdentifierAndSerialNumber(identifier, serailNumber); ... var passbook1 = passbook1.getPassWithTypeIdentifierAndSerialNumber(identifier, serailNumber);
Return Values
Return Value | Description |
---|---|
com.kony.Pass [Object] | The pass with the given pass type identifier and serial number, or nil if there is no such pass or if the app doesn’t have the appropriate entitlement. |
Platform Availability
- iOS
Returns the passes in the user’s pass library.
Your app only has access to certain passes, based on its entitlements. Passes that your app doesn’t have access to are not returned. The ordering of the passes is not fixed; calling this method multiple times may return the same passes but in a different order.
Syntax
<<PassObject>>.getPasses();
Example
var passbook1 = passbook1.getPasses();
Return Values
Return Value | Description |
---|---|
Array | An array of com.kony.Pass objects. |
Platform Availability
- iOS
Removes the pass from the user’s pass library. This method does nothing if your app doesn’t have the appropriate entitlement. The new pass replaces the existing pass with the same pass type identifier and serial number. If there is no such pass in the user’s pass library, the replacement fails.
Syntax
<<PassObject>>.removePass();
Input Parameters
Parameter | Description |
---|---|
identifier [String] - Mandatory | The pass’s pass type identifier. |
serailNumber [String] | The pass’s serial number. |
Example
passbook1.removePass(identifier, serailNumber);
Return Values
None
Platform Availability
- iOS
Replaces a pass in the user’s pass library with the given pass.
Syntax
<<PassObject>>.replacePassWithPass();
Input Parameters
Parameter | Description |
---|---|
pass [Object] - Mandatory | The new pass. |
Example
passbook1.replacePassWithPass(pass); ... var passbook1 = passbook1.replacePassWithPass(pass);
Return Values
Return Value | Description |
---|---|
Boolean | True if the pass was replaced successfully; otherwise false. |
Platform Availability
- iOS