Sample Code

Illustrates importing the certificate and setting up login credentials, as well as other APIs related to certificate handling:

/// SUP101DB is a generated database class
///First install certificates on your simulator, for example "Sybase101.p12"


//Getting certificate from certificate store 
CertificateStore myStore = CertificateStore.getDefault();                     
String filter1 = "Sybase";
StringList labels = myStore.certificateLabels(filter1, null);        
String aLabel = labels.item(0);
LoginCertificate lc = myStore.getSignedCertificate(aLabel, "password");

// Save the login certificate to your synchronization profile
SUP101DB.getSynchronizationProfile().setCertificate(lc);

// Login to and synchronize with Unwired Server
SUP101DB.subscribe();
SUP101DB.synchronize();

// Save the login certificate to your data vault 
// The vault must be unlocked before saving
// SybaseDataProvider.apk package must be installed on Android device
String vaultName = "myVault";
DataVault vault = null;
if(!DataVault.vaultExists(vaultName))
{
    vault = DataVault.createVault(vaultName, "password", "salt");
}
else
{
    vault = DataVault.getVault(vaultName);
}
vault.unlock("password", "salt");
lc.save("myLabel", vault);

//Loading and deleting certificate
LoginCertificate newLc = LoginCertificate.load("myLabel", vault);
LoginCertificate.delete("myLabel", vault);