How can I get real-time heart rate data in a progressive web app for phones? - progressive-web-apps

I'm building a progressive web application (target is smart phones for now). The app needs to be able to access heart rate and heart rate variability, ideally in real-time. While it seems totally asinine, I'm open to using REST calls to some remote server if that is the only way. I'm also fine with restricting the app to only work with certain hardware if necessary. In this case, the ideal hardware would be some sort of earbud that uses optics to scan for heart rate, but at this point, I'm open...
The best that I have thought up is to find a heart rate monitor that converts the direct signal into audio and use the microphone web API. That seems like a lot more work than ideal, so I'm hoping someone has a better idea. Any ideas are welcome. Please, no one downvote anyone if it doesn't solve all my constraints. I've been working on this for a bit and I'm not sure that there is a clean and perfect solution yet. Thanks in advance!

If the sensor can speak Bluetooth, the Web Bluetooth API can perhaps help: https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API
https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web

How about use a Web Bluetooth that lets you control any Bluetooth Low Energy device like heart rate monitors. It will read the Service Location Characteristics (which tells your where the sensor is placed - which body part) and subscribe to notifications from the Heart Rate Characteristics, meaning you will get an event whenever the device performs a new measurement. Then use a service worker that will define the behavior of the app to mimic native app capabilities like offline support and notifications.
It's like a Physical Web that you can send a link to your website from a Bluetooth beacon to a user's device and with PWA, that link can be to your web app that looks, feels and functions like a native app. Then with Web Bluetooth, you can then speack to the device. Visit this blog post for more details.

Related

How to send push notifications to a specific device through fcm without authorization or google account?

I want to have my application receive notifications without forcing the user to be logged in or authenticated. Thank you for your time!
Well, I'm using OneSignal to send notificaitions to the users of my Android app and it's working fine. Moreover, it uses FCM as its base. So, that shouldn't be a problem too. You can segment users thet way you want and send notifications to one or many - upto you. It's all for free and very easy to set up the basics of it. It's here: OneSignal
You can probably use Socket IO for your case to send messages from one device to another.
There are many good to have Socket IO frameworks which can consider for your requirement
Signal R in Android
SignalR is a new library used to add real-time web functionality to your applications. Signal R uses technology such as
web sockets
Event Source,
forever frame
long polling
Signal R is capable of selecting the best from those four technology depending on your internet connection and your application stability.
Signal R is used in application such as
Chatting application
Stock market application
Real-time gaming
Native Socket.IO
Socket.IO provides an event-oriented API that works across all networks, devices and browsers. Its incredibly robust (works even behind corporate proxies!) and highly performant, which is very suitable for multiplayer games or realtime communication.

How does the Google Maps IPhone app notify with Bluetooth

I'm looking for some reference to how the Google Maps app is able to send turn by turn directions to in car bluetooth systems. The reason being that my car does not support A2DP so i haven't been able to stream my music/podcasts directly to the radio.
Google seem to be using the phone profile, otherwise known as the Hands Free Protocol- HFP, and it looks like a call on the in car radio.
If someone could point me to the API to make this happen I could potentially use this little quirk to write an app that supports streaming to my car stereo system.
Does anyone know what API this is? Or if you have example code that would be even better. This one has been a tough one to track down on Google!

Using the new MonoTouch.CoreBluetooth namespace

I have found a few samples on how to use GameKit for bluetooth communication and even accessing bluetooth functionality using native code but no example on how to use the MonoTouch.CoreBluetooth namespace.
Seems a shame using hacks when the full implementation is just waiting to be used.
Can anyone please share a sample or source (a link to a book would work as well) for the new MonoTouch.CoreBluetooth.
CoreBluetooth is just for communicating with devices that utilise the Bluetooth Low Energy Profile, such as watches, heart rate monitors etc.. It is not possible to use any other profiles with CoreBluetooth, so not possible to connect to another phone, a computer etc...
(Although given the name, I hope in future apple will provide lower level access to bluetooth comms in this framework)

Phonegap app performance vs native app performance

we are looking at getting a barcode scanning application built. We are considering using PhoneGap but our only worry is speed.
All the application will do is just scan a barcode and check a server to see if it's valid or not. The application uses the camera very intensely to scan the barcode via an image.
My main question is, will scanning via phonegap be just as fast as a native app? Speed is really important as the user will have to scan multiple barcodes very quickly.
Phonegap uses the same native APIs, it just abstracts them so that you can write your application in html and javascript. The time to take a picture or any other native process is less important than the time the user perceives. This is the portion of the native execution time that you need to expose to the user + Abstraction API time + UI responsiveness.
There is always an overhead from an abstraction but I think that's negligible in an app like this (in phones newer than BB OS5). The current issues originate from the hardware rendering the HTML and the browser software installed on the device.
A lot of BlackBerry phones don't use webkit (OS5 and below) and the the browsers they do use can seem very sluggish while rendering webapps. BB OS versions less than 5 don't have a production worthy way of communicating between the native and javascript layers, the hack that's often seen is to set and poll for changes in cookies. Android has always had a good design for JavaScript to native interaction afaik.
BlackBerry phones and many lower end Android phones don't have GPU's, or some Android phones that do have GPU's don't compile webkit for the GPU! Without this your UI app may
have that sluggish feel, pages/buttons take that bit longer to respond which is very noticeable when you're trying to whiz through menus.
This has improved a lot since phonegap was released. UI lag should continue to decrease to a point where even new low end phones are production ready for webapps. But from my experiences we've not yet reached that point in 2011.
The phone's built-in software is what does the scanning and camera action. PhoneGap will only trigger the event and help transfer the data but the phone does all the work.
As others noted the html5-based UI may feel sluggish. Maybe it's not an issue; you just have to try it and see. For scanning a barcode and uploading to a server the Phonegap overhead might not be signficant.
I have developed a smartphone app where barcode scanning is an alternative to the primary function of scanning an image which is recognized by picture matching technology. I use PhoneGap. I have not compared this to native app performance. I am able to say that for my basic UI (it is a web app for the smartphone), my web pages are rendered fast enough not to be an issue. This performance has been observed on a 600MHz smartphone CPU (LG Optimus One running Android 2.2.1).
The picture matching as well as barcode scanning is done on a server backend, not on the smartphone itself. The issue becomes one of networking speed from smartphone over WiFi or service provider network, over the Internet and onto the server - then there is the response from server back to smartphone. The processing speed of picture matching or barcode scanning has to be less than a second (ideally half a second) so that by the time networking delay is added, it is still a 1-2 second response time for the user.
The image files that I am transferring from smartphone to server is targeted to be around 40KB. At a typical 54Mbps WiFi network or the going rate of around 40Mbps in HSPA+ service provider networks, I find the performance of my app to be suitable. Even with a fair signal WiFi speed of 15Mbps, end-user response is acceptable between 1-2 seconds.
The pace of smartphone development (dual core processors) and service provider networks (4G HSPA+) will only take the industry higher. It is a tremendous opportunity for apps development moving forward.
Side Topic:
I am using Zbar code on the server for barcode scanning and I am hunting for better alternatives. The challenge with ISBN barcode scanning from smartphones having non-zoom, non-macro lens is that the typical barcode size is too small for "simple" barcode scanning algorithms to work properly. I'd like to hear about alternatives and people's experience with barcode scanning. I would be looking for code that I can deploy in my server backend, as opposed to running smartphone resident barcode scanning.

iPhone peer-to-peer voice chat

I see that Game Kit allows you to develop games with voice chat.
I want to build a more general, peer-to-peer voice chat application, that does not have to live in the Game Center. So a couple questions:
1. What peer to peer system/technologies could be used for this?
2. If I wanted to allow voice chat with a Flash client (i.e. iPhone app <--> Server <---> Flash client on PC) would options for 1 work for this?
I have some experience with RTFMP for Flash to Flash client chat, and no iPhone dev experience, so just want to test out some ideas.
Maybe one idea: build using the Ribbit Platform - they have both Objective-C and Flash SDKs, but this looks more like traditional\SIP calling.
Anyway, would appreciate anything that points me in the right direction.
Thanks.
Now that flash has access to raw Microphone data, you could roll your own client and server; yet, since, currently, it doesn't have UDP sockets in AIR for mobile, you would be forced into considering audio quality vs lagg with even tighter restrictions then usual.
You can now roll your own native extension to make this work; yet, I am assuming you want something that only requires coding in AS3.
Therefore, considering your restrictions, the only real bet would be to use Flash's built-in communications capabilities (e.g. RTMP).
With the above being said, there are opensource alternatives to the array of Adobe's own flash communication servers:
the red5 server, and rtmpd.
IMHO Ribbit's services are kind of pointless.