Azure IoT Hub Telemetry Data to Mobile Application - azure

I'm trying to get data from arduino yun to azure iot hub and read data from mobile app. So I created IoT Hub on Azure and able to read telemetry data with nodejs on my computer. It's working good. But trying to create react app for reading data. What should I do for best way to handle this. I must use react native for mobile application part.
Project info:
Load cell reading data, if change then it will provide info to iot hub as telemetry. Then it should inform mobile application created with react native for users.
For testing using button press right now. Main code for load cell will deploy in the future. Sending data from arduino yun to local computer and pushing with nodejs application to Azure.

I manage to solve issue with some escape resolutions:
Used a localhost to get messages from yun and transfer them to iot hub with nodejs backend and libraries.
Used a webapp for visualize. Also now I am able to make a get request from anywhere on my mobile app load. Integrated that in webapp code with endpoint.
Also used websocket to get information from webapp to mobile device.
Created custom png file to show different stats and pressed values to text.
I wish that I can send telemetry from device directly to azure. But couldn't manage to solve that.

Related

Azure Iot Hub Direct Method Call from front end Node.js Website

I am doing my final year project Using Azure Cloud. I have connected my raspberry pi where I have deployed my python code to trigger the device connected to its GPIO pins. These pins are triggered by "Azure-iot-Hub direct method call". How can I integrate this thing in website? I want to create a button on website and every time when I will press this button the direct method should be called. Is there any way to do this?
Unless creating website is in the scope of project, the easiest option is to use IoT Central, create a device template with associated telemetry, properties and commands.
If creating a custom website, wire the direct method IoT Hub Rest API to your application web page. https://learn.microsoft.com/en-us/rest/api/iothub/service/devices/invoke-method
or use the nodejs service client https://github.com/Azure/azure-iot-sdk-node/blob/main/service/samples/javascript/invoke_command.js
Depending on what web stack you are using, the appropriate SDK can be used (nodejs, python, c#, c or java)

Raspberry Pi Web Simulator- Azure IoT Hub- blank chart

I'm using Raspberry Pi simulator with IoT hub azure, I followed the steps correctly but when I checked the chart, I got a blank chart, even I set the connection string and Device Id and consumer group on the web settings.
PS: I can see the messages in Raspberry simulator and Azure IoT tools with visual studio code.
any advice?
thanks in advance
It looks like your web app and IoT Hub is not connected. I would suggest you, recheck your connection string generated along with consumer group and make sure you set these values correctly.
I followed the official documentation to Visualize real-time sensor data from your Azure IoT hub in a web application and able to see the data without any issues.
Here is my output:
Please follow the documentation and let me know if you need further help.

how to integrate getstream.io into cordova / phonegap?

i am using cordova to build native mobile app. I already have an account in stream.
Currently i need to build a feed like facebook into my app and would like to check UI/UX design layout is included in getstream.io ?
Second, how to integrate getstream.io into my cordova app ? is it just copy the getstream.js into my cordova app ?
We don't have any built in user interface, that's entirely up to your application.
We also don't recommend connecting directly to Stream from a mobile application for several reasons. For starters, your API credentials can be easily extracted from the application, which could cost you money if someone abuses your account. Secondly, the socket connections to constantly connect to Stream and read feed updates would use up a lot of battery and data for your users. Better to have your mobile app connect to a back end server, and have that server connect to Stream.

Push notifications on android emulator using Xamarin Forms via Azure Notification Hubs

I am embarking on setting up a Xamarin Forms project for proof of concept with an aim of having an Android app running in the Android emulator registering and receiving google cloud notifications sent via Azure's notification hub.
In researching this I have found some sample code which assumes a backend which uses Microsoft Azure's Mobile Services back end.
I'd prefer not to have a dependency in my client code on Mobile Services backend if possible. However, maybe this is unavoidable (or inadvisable) when using Azure Notification Hubs. That is really the central issue I am raising with this question.
The tutorial linked below shows an approach to register and receive notifications using a Xamarin forms app which is dependent on the Azure Mobile Services backend.
https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-xamarin-forms-get-started-push/
Whereas, this second tutorial shows an approach where the mobile client app (developed using Xamarin Android) registers to the Google messaging cloud rather than Azure notification hubs).
https://developer.xamarin.com/guides/android/application_fundamentals/notifications/remote_notifications_in_android/
Where I am coming unstuck is trying to figure out which is the right approach to enabling a Xamarin forms app to register and receive notifications which are pushed via Azure notification hub.
Will the approach of the 2nd tutorial (device registers for push notifications directly with Google cloud) work when notifications are sent via Azure Notification Hubs (configured with the correct API credentials for google messaging) or am I missing something ?
In other words am I making life difficult for myself by adopting the 2nd approach ?
My focus is on developing using Xamarin forms but with Android as the lead device type for initial prototype , proof of concept and then moving on to iOS and Windows Universal 10 at a later stage.
My 2 cents.
The whole point of using Azure Notification Hubs is to abstract away the need to handle Google and iOS push notification systems. Since you are planning to eventually do both iOS and Android, I would suggest registering through Azure.
Azure will handle the iOS feedback channel when registering devices which is nice and you are able to use message templates in Azure which means you can send a single notification hub message and it will be automatically transformed into a message that Android's GCM expects to see and another message that iOS' APNS expects to receive (they both expect different notification message formats).
Since it sounds like no matter which option you choose, you are planning to send messages through Azure, you are going to have to deal with the same Notification Hub limitations, meaning you do not gain much from registering directly through the native server interfaces (limitations in the number of tags a message can have is what I am mainly thinking about).
There is also a library for both platforms if you want to register directly from the device or you can, like we did, have the mobile device call one of your own backend server which can do some initial processing before sending the registration request to azure for the device.
*Edit: Though if you just want to get something working, I do not see a problem with registering directly to GCM and then later on switching out the code to do it through Azure later on.

one Azure mobile service NotificationHub to send Push Notifications to Two Different IOS Apps

We are using Azure mobile service NODE back end as a server. We are using Notification Hub to push notify our iOS and Android clients. However, we have one more requirement to develop an admin portal app in iOS.
So,We are going to develop one separate app for Admin portal.This app also has requirement to send the Push notification. Means Azure mobile service will have to send Notifications to existing iOS and android app as well as this new iOS Admin app.
My doubt is, can I send push notification to two different clients of iOS from the single Azure mobile Services Notification Hub? Because when I checked PUSH configuration on the Azure portal it shows only one .p12 file upload provision.
In my case it will be two different .p12 files i.e. one is already uploaded for existing iOS client and one I will have to upload for iOS admin app.
Can some somebody help me or guide me to the right path? I am quite new the Azure mobile services. I searched a lot regarding this topic but did not get anything related to my scenario.
Will it be possible to send PUSH to two separate iOS clients which are pointing to same Azure Mobile Service Notification Hub? Or I will have to create separate mobile service for that?
You will need a separate Notification Hub for each app. You can keep your Mobile Service using the existing Notification Hub for your main app, and create a new Notification Hub for your admin app.
Then in your Node scripts for the admin app that need to register devices or send notifications, use the 'azure' npm to connect to the admin app Notification Hub, as described in this article. The Mobile Services Node backend already includes the azure npm, so you can skip running 'npm install azure'.
var azure = require('azure');
var notificationHubService = azure.createNotificationHubService('hubname','connectionstring');

Resources