Search in sources :

Example 1 with NotificationSettings

use of org.openhab.habdroid.core.notifications.NotificationSettings in project openhab-android by openhab.

the class OpenHABMainActivity method getNotificationSettings.

/**
 * Returns the notification settings object
 * @return Returns the NotificationSettings or null, if openHAB-cloud isn't used
 */
public NotificationSettings getNotificationSettings() {
    if (mNotifySettings != null) {
        return mNotifySettings;
    }
    Connection cloudConnection = ConnectionFactory.getConnection(TYPE_CLOUD);
    if (cloudConnection == null) {
        return null;
    }
    // check whether URL is valid
    try {
        new URL(cloudConnection.getOpenHABUrl());
        mNotifySettings = new NotificationSettings(cloudConnection);
        return mNotifySettings;
    } catch (MalformedURLException e) {
        return null;
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) Connection(org.openhab.habdroid.core.connection.Connection) DemoConnection(org.openhab.habdroid.core.connection.DemoConnection) NotificationSettings(org.openhab.habdroid.core.notifications.NotificationSettings) URL(java.net.URL)

Aggregations

MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Connection (org.openhab.habdroid.core.connection.Connection)1 DemoConnection (org.openhab.habdroid.core.connection.DemoConnection)1 NotificationSettings (org.openhab.habdroid.core.notifications.NotificationSettings)1