Android™
Android™
MIME Advanced CMS and Compatibility Option Properties
See more MIME Examples
Demonstrates advanced option properties: CmsOptions (a JSON string of advanced CMS/PKCS #7 signing and validation options), UnwrapExtras (whether UnwrapSecurity adds informative header fields describing removed security layers), and UncommonOptions (an option string for uncommon compatibility requirements).
Background. These properties adjust behavior only in specialized situations. Their defaults (empty CmsOptions, UnwrapExtras enabled, empty UncommonOptions) are correct for normal use; UncommonOptions in particular should be set only when directed by support.
Chilkat Android™ Downloads
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
boolean success = false;
CkMime mime = new CkMime();
success = mime.SetBodyFromPlainText("Message body.");
if (success == false) {
Log.i(TAG, mime.lastErrorText());
return;
}
// CmsOptions is a JSON string of advanced CMS/PKCS #7 signing and validation options. The default
// is an empty string, which selects normal behavior. An empty JSON object {} is also valid.
mime.put_CmsOptions("{}");
// UnwrapExtras controls whether UnwrapSecurity adds informative header fields describing the
// security layers it removed. The default is true.
mime.put_UnwrapExtras(true);
// UncommonOptions is a semicolon-delimited option string for uncommon compatibility requirements.
// Normal applications should leave it empty, and it should only be used when directed by support.
mime.put_UncommonOptions("");
Log.i(TAG, "CmsOptions = " + mime.cmsOptions());
Log.i(TAG, "Advanced options configured.");
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}