use of com.openmeap.thinclient.update.UpdateHandler in project OpenMEAP by OpenMEAP.
the class MainActivity method onCreate.
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get rid of the android title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
CredentialsProviderFactory.setDefaultCredentialsProviderFactory(new OmSlicCredentialsProvider.Factory(this));
HttpRequestExecuterFactory.setDefaultType(HttpRequestExecuterImpl.class);
DigestInputStreamFactory.setDigestInputStreamForName("md5", Md5DigestInputStream.class);
DigestInputStreamFactory.setDigestInputStreamForName("sha1", Sha1DigestInputStream.class);
// setup the SLICConfig instance
Preferences prefs = new SharedPreferencesImpl(getSharedPreferences(SLICConfig.PREFERENCES_FILE, MODE_PRIVATE));
try {
Properties props = new Properties();
props.load(getAssets().open(SLICConfig.PROPERTIES_FILE));
config = new AndroidSLICConfig(this, prefs, props);
} catch (IOException ioe) {
// then the application is fail
throw new RuntimeException("The primary configuration file (" + SLICConfig.PROPERTIES_FILE + ") could not be opened.");
}
// perform our first-run-check
Object o = getSystemService(Context.WIFI_SERVICE);
if (o instanceof WifiManager) {
WifiManager wifiManager = (WifiManager) o;
WifiInfo wifiInfo = wifiManager.getConnectionInfo();
if (wifiInfo != null && wifiInfo.getMacAddress() != null) {
Runnable firstRunCheck = new FirstRunCheck(config, wifiInfo.getMacAddress(), HttpRequestExecuterFactory.newDefault());
new Thread(firstRunCheck).start();
}
}
if (config.isDevelopmentMode()) {
System.setProperty(HttpRequestExecuter.SSL_PEER_NOVERIFY_PROPERTY, "true");
} else {
System.setProperty(HttpRequestExecuter.SSL_PEER_NOVERIFY_PROPERTY, "false");
}
storage = new LocalStorageImpl(this);
updateHandler = new UpdateHandler(this, config, storage);
// Calls the title from client.properties
// setupWindowTitle();
}
Aggregations