android icon indicating copy to clipboard operation
android copied to clipboard

Setting the number of vibrations when receiving a notification.

Open steneor opened this issue 6 years ago • 9 comments

Hello Congratulations and thank you for this great application. I use this app to receive notifications from a sick person - my father - monitoring system. It works perfectly but I would like to have an additional setting. That is, I would like to be able to set the number of vibrations from 1 to 5 when I receive a notification. Indeed currently there is only one vibration, which is often not enough to wake me up. So if I could adjust the number of vibrations to 3 or 5 for example, I would be sure to wake up so as to treat my father. Thank you in advance and congratulations for your work and sharing.

steneor avatar Feb 16 '19 13:02 steneor

Hey @steneor thanks for your feedback!

We could add 'vibrations amount' as an extras property (gotify/server#120). It could be under the namespace android::notification::vibration::amount.

Issue requires #50

jmattheis avatar Feb 17 '19 18:02 jmattheis

Hi again, Thanks a lot for your answer. I am looking forward to the next release !

steneor avatar Feb 18 '19 06:02 steneor

I suggest what we design a schema to describe the notification effect on android.

I suggest that notification is encapsulated in one extra key which describes whether displays a notification on the notification bar, how to vibrate, etc.

{
    "extras":{
        "android::notification":{
            "notification":{
                "show":true,
                "click":{
                    "action":"open-url",
                    "url":"http://example.com/example.html"
                }
            },
            "alarm":{
                "vibration":{
                    "force":true,
                    "pattern":{
                        "pattern":[
                            200,
                            300,
                            200,
                            300
                        ],
                        "amplitude":[
                            -1,
                            -1,
                            -1,
                            -1
                        ],
                        "repeat":3
                    }
                }
            }
        }
    }
}

Maybe we can start with vibration pattern and then add support to other properties.

eternal-flame-AD avatar Feb 23 '19 14:02 eternal-flame-AD

@eternal-flame-AD Yeah seems good 👍. However I don't like that there is pattern.pattern, maybe there is a better naming for it (:.

jmattheis avatar Feb 23 '19 14:02 jmattheis

Maybe call it "pattern.timing" so it is in accordance with the VibrationEffect API?

eternal-flame-AD avatar Feb 23 '19 14:02 eternal-flame-AD

Yup, thats better.

jmattheis avatar Feb 23 '19 14:02 jmattheis

I sent it extra data, but not received it on app.

image

In 'WebSocketService.java' file, extras values are null 'showNotification' function. Is it possible to send extra data on server?

ghost avatar Mar 27 '20 09:03 ghost

@happymario, please create a new issue, and don't comment on already existing one, which doesn't have exactly your problem.

Like described in https://gotify.net/docs/msgextras extras must be send with a application/json request. You send it with form-data.

jmattheis avatar Mar 29 '20 06:03 jmattheis

Thank you I sent it json request.

curl --location --request POST 'http://192.168.0.135/message?token=AnU.0L_1wm8qV8P' \
--header 'Content-Type: application/json' \
--data-raw '{
  "titie":"test",
  "message":"test",
  "priority":0,
  "extras": {
    "client::display": {
      "contentType": "text/plain"
    }
  }
}'

It works well.

ghost avatar Mar 29 '20 09:03 ghost

Closing as not needed as there aren't many upvotes or comments from other users.

jmattheis avatar Feb 02 '23 14:02 jmattheis