Download Developer Guide: BlackBerry Native Applications

Transcript
Reference
Common APIs
In addition to Object State APIs these APIs are available with each mobile business object.
•
•
•
•
•
•
•
•
save – save a record to the local database, In the case of an existing record, save calls
update. In the case of a new record, save calls create.
refresh – client refreshes the entity from the local database.
cancelPending – cancels a pending record.
submitPending – submits a pending record to the server.
getPendingChange – if pending is true, then 'C' (create), 'U' (update), 'D' (delete), 'P' (to
indicate that this row is a parent in a cascading relationship for one or more pending child
objects, but this row itself has no pending create, update or delete operations). If pending is
false, then 'N'.
getReplayCounter – updated each time a row is created or modified by the client. This
value is derived from the time in seconds since an epoch, so it always increases each time
the row is changed.
getReplayPending – when a pending row is submitted to the server, the value of
replayCounter is copied to replayPending. This allows client code to detect if a row has
been changed since it was submitted to the server --the test to look for : replayCounter >
replayPending. On receiving a successful response (replayResult) from the server, this is
reset to 0.
getReplayFailure – when the server responds with a replayFailure message for a row that
was submitted to the server, the replayCounter value is copied to replayFailure, and
replayPending is set to 0.
Security APIs
The security APIs allow you to customize some aspects of connection and database security.
Connect Using a Certificate
You can set certificate information in ConnectionProfile.
ConnectionProfile profile = <PkgName>DB.getSynchronizationProfile();
profile.setDomainName( "default" );
profile.setServerName( "host-name" );
profile.setPortNumber( 2481 );
profile.setNetworkProtocol( "https" );
Install the certificate to BlackBerry:
•
•
Simulator: copy the certificate to the simulator directory.
Physical device: use the Desktop Manager Certificate Synchronization tool to import an
HTTPS public certificate from the PC to the device. Then perform a synchronization with
Unwired Server by HTTPS.
Developer Guide: BlackBerry Native Applications
43