This adds a button that shows a QR code containing the subscription information necessary to use the subscription: the URL endpoint and the vapid authorization header.
WIP: Add QR Code to Send Push Messages from an external device #2
maximiliangalanis/android-example:add_qr_code into main
It works already. I would appreciate feedback on the implementation :)
Thanks !
A few things about the implementation:
- We don't need to store the vapid header in the shared prefs, we just call the getVapidHeader when we need it
- We don't need to introduce a parameter to force a new header (
createNew). I think you have done it to avoid getting the one in cache ? The VAPID header is valid for 12h, and cached for 5min, so it is not important if we get the cached one (it will still be valid for almost 12h)
Regarding the content of the QR code, maybe it can be an URL taking the required elements in the fragment part, for instance:
https://example.unifiedpush.org/#endpoint=http://endpoint&p256dh=aa&auth=aa&vapid=aaaa
@maximiliangalanis We can use https://unifiedpush.org/test_wp.html for the QR code !
https://unifiedpush.org/test_wp.html#endpoint=ENDPOINT&auth=AUTH&p256dh=PUBKEY and you can add &vapid=authorization header
I've added the link to the app: c7e90ea5c5
- app/build.gradle
- app/src/main/java/org/unifiedpush/example/ApplicationServer.kt
- app/src/main/java/org/unifiedpush/example/activities/ui/CheckUi.kt
- app/src/main/java/org/unifiedpush/example/activities/ui/CheckUiState.kt
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.
Related to an Android component
Something is not working
Contributions are very welcome, get started here
This issue or pull request already exists
New feature
Interested in contributing? Get started here.
Need some help
Something is wrong
Related to a linux component
More information is needed
Related to an upstream repository, already reported there
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?