Linking a progressive web app to a beacon to trigger a event

萝らか妹 提交于 2020-01-04 17:46:12

问题


I'am trying to make a progressive web app where I will use beacons to transmit the eddystone URL. As soon as the phones catch the Eddystone URL and click on the notification(using physical web) it will open the Progressive web app. My question is that is there a way to integrate the web app with beacons such that when the phone comes in the range of a certain beacon, it triggers an event specific to that. For eg: if i go in a park and there is a beacon on a bench, the PWA should know be aware of the beacon on that bench and accordingly actions should be triggered. Thank you.


回答1:


Simply configure each beacon with a unique url suffix that matches the location where they are installed. If your web app is at:

http://mywebapp.com/path

Then the URL configured for the beacon on the park bench might be:

http://mywebapp.com/path?beacon_id=park_bench

You may need to use a URL shortening service to make such URLs small enough for Eddystone-URL.

You will also need to build your web app to detect which URL suffix launched it and take appropriate action.




回答2:


Eddystone-URL beacons could only do is transmit the URL. The mobile device is only detecting these signals only when a user has swiped down on their notification bar. When the user has tapped on it, that's the only time they are taken (take note of keyword: taken) to the site. There is no connection between the mobile device and the beacon unless you create a backend service that connects the site and the mobile device through service workers.

PWA is not an app, its still a website that utilises the modern web technologies (if supported by the browser). The notifications are passive notifications meaning, users will only notice it if they need it. It will not vibrate nor give an audible sound when you are near one unless you build an app for this. This is why they came up with this method because app notifications were already intrusive.



来源:https://stackoverflow.com/questions/44472935/linking-a-progressive-web-app-to-a-beacon-to-trigger-a-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!