Search in sources :

Example 1 with NewAlert

use of nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.NewAlert in project Gadgetbridge by Freeyourgadget.

the class Mi2TextNotificationStrategy method sendAlert.

protected void sendAlert(@NonNull SimpleNotification simpleNotification, TransactionBuilder builder) {
    AlertNotificationProfile<?> profile = new AlertNotificationProfile<>(getSupport());
    // override the alert category,  since only SMS and incoming call support text notification
    AlertCategory category = AlertCategory.SMS;
    if (simpleNotification.getAlertCategory() == AlertCategory.IncomingCall) {
        category = simpleNotification.getAlertCategory();
    }
    NewAlert alert = new NewAlert(category, 1, simpleNotification.getMessage());
    profile.newAlert(builder, alert, OverflowStrategy.MAKE_MULTIPLE);
}
Also used : AlertNotificationProfile(nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.AlertNotificationProfile) NewAlert(nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.NewAlert) AlertCategory(nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.AlertCategory)

Example 2 with NewAlert

use of nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.NewAlert in project Gadgetbridge by Freeyourgadget.

the class MiBand2Support method onTestNewFunction.

@Override
public void onTestNewFunction() {
    try {
        TransactionBuilder builder = performInitialized("incoming call from peter");
        NewAlert alert = new NewAlert(AlertCategory.Custom, 1, new String(new byte[] { 0x19 }));
        AlertNotificationProfile<MiBand2Support> profile = new AlertNotificationProfile<>(this);
        profile.newAlert(builder, alert, OverflowStrategy.MAKE_MULTIPLE);
        builder.queue(getQueue());
    } catch (IOException e) {
    }
}
Also used : AlertNotificationProfile(nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.AlertNotificationProfile) NewAlert(nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.NewAlert) TransactionBuilder(nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder) IOException(java.io.IOException)

Aggregations

AlertNotificationProfile (nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.AlertNotificationProfile)2 NewAlert (nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.NewAlert)2 IOException (java.io.IOException)1 TransactionBuilder (nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder)1 AlertCategory (nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.AlertCategory)1