Search in sources :

Example 6 with AlertNotificationProfile

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

the class PineTimeJFSupport method onSetCallState.

@Override
public void onSetCallState(CallSpec callSpec) {
    if (callSpec.command == CallSpec.CALL_INCOMING) {
        TransactionBuilder builder = new TransactionBuilder("incomingcall");
        String message = (byte) 0x01 + callSpec.name;
        NewAlert alert = new NewAlert(AlertCategory.IncomingCall, 1, message);
        AlertNotificationProfile<?> profile = new AlertNotificationProfile<>(this);
        profile.setMaxLength(MaxNotificationLength);
        profile.newAlert(builder, alert, OverflowStrategy.TRUNCATE);
        builder.queue(getQueue());
    }
}
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)

Example 7 with AlertNotificationProfile

use of nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.AlertNotificationProfile 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)

Aggregations

AlertNotificationProfile (nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.AlertNotificationProfile)7 NewAlert (nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.NewAlert)7 TransactionBuilder (nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder)4 AlertCategory (nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.alertnotification.AlertCategory)4 IOException (java.io.IOException)2 ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageManager (android.content.pm.PackageManager)1