I am totally lost in this point I have finished my subscriptions payment from android application and I need to listen for any subscription on my own backend server to give subscriber the service, but I don't know how to make this happen in proper way, if any one had experience in this point please help .
I haven't find any thing useful in google documentation or YouTube .
thanks
I need step by step to make it work.
You need to enable PUB/SUB API in your project; check this quick guide and also ensure that you have selected Android Management API is enabled.
Once you have enabled the API you need to create a topic which can publish notifications. You can do it manually in GCP console and by using Pub/Sub topic method
Now you need to create a subscription which captures the stream of messages published. check create subscription method.
Grant Android device policy and you cand do them manually from console or by Pub/Sub; check this.
You need to call enterprises.patch to specify the below parameters
pubsubTopic: projects/{project}/topics{topic}.
enableNotificationTypes: ENROLLMENT, STATUS_REPORT and COMMAND.
You can use Pub/Sub API to get notifications.
Related
I want to automate the workflow to send out mail notifications once Load test under Azure Devops project is completed. I get to see there is no direct option available for the same. Please suggest what could be the best suitable solution.
I have created a simple URL based Load test and ran it. One way I already tried is using Devops REST API and get the status in Azure function. But that is tedious process. Please help in this.
result expected is immediately once Load test is done, there should be email triggered to the group or individual members
For now, the way you mentioned might be the way to go, as Azure DevOps does not provide notifications from this type of events OOB. Please submit your suggestion here.
References:
Default and supported notifications
Supported event types
Meanwhile, another idea I had was to have this test configured as a task in a Pipeline, so that you get an email notification sent upon build completion. However, do note that while the Cloud-based Load Test task can be added to a Job as of today, it has been deprecated, with these options as alternatives.
I am using HTML Agility pack in Xamarin forms to scrape data from a website. When a condition returns true, I want to send a push notification to all users. However, this data is changing a lot and I think it would cost a lot of internet data and maybe battery, if the device with this app is constantly collecting the data in the background to check a certain condition.
This is a piece of the code to give you an idea:
var url = "https://www.goal.com/en-us/live-scores";
var httpClient = new HttpClient();
var html = await httpClient.GetStringAsync(url);
var htmlDocument = new HtmlDocument();
htmlDocument.LoadHtml(html);
var voetbalWedstrijdenHTML = htmlDocument.DocumentNode.Descendants("div").Where(node => node.GetAttributeValue("class", "")
.Equals("main-content")).ToList();
So I thought it might be a good idea to let only one device use this code and check if the condition is true and then only send the push notification to all users. I've made this image to give you a better idea about what I mean.
I thought it might be a good idea to use firebase messaging to send push notifications to all users, but how or what do I use to have only one device checking the C#? Should I use a website with the C# code that is running 24/7 (is this possible?), or something else? So... how do I run C# code 24/7?
EDIT:
I found out about 'Firebase functions'. Would this work for me? I'd have to change to javascript so I rather stick to C#.
Here's how i would have done it
Create an Azure web job that checks the condition. You can schedule it to run according to your requirements.
Create an Azure notification hub (ANH) and link it to Firebase and equivalent in IOS and other platforms as per requirements.
Create a web api that every app user will call. In this api call, register every device with Azure notification hub. The registrations can include tags to which you can send notifications to.
When the web job needs to trigger a notification, it will call the ANH directly or through the web api and send a broadcast notification. You can also narrow down the users to send notifications based on tags.
One advantage of using ANH is that you don't need to worry about sending to multiple platforms. You just send to tags it will go corresponding users of all platforms.
I believe that this document may help you. https://learn.microsoft.com/en-in/azure/notification-hubs/. Hope I have helped.
EDIT:
Would you be using 2 projects: Yes you would be using atleast 2 projects. One for web api and 1 for each platform that you want your app to be in.
Point in Using Azure Notifications: It comes with great deal of features that will make your life easier especially if your application runs on multiple platforms. However, you can use FCM directly. Actually ANH will also use FCM behind the doors.
Putting the code you want to run every some time in Startup.cs: Thats a bad idea. You should ideally be using a web job for that. Startup code is executed only once in lifetime of application. You don't want your notification trigger code to be in Startup class. However if using webjob is not something you want, you can be using the cron scheduler.
EDIT 2:
You can use the timer in Startup.cs however, i would not recommend that. One class should ideally have only one purpose and business logic is not for Startup. You should consider moving out the method to another class.
If you decide to use webjobs, you would create different projects for web job. These offerings like ANH, web job etc exist for one reason - to make your life easier. You can always do everything on your own if you are ready to work extra mile.
PS web job is becoming obsolete and people are now moving to Azure functions.
I am working in Azure notification hub, and the notifications send to the IOS applications. Following ,
https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-ios-apple-push-notification-apns-get-started
But the problem is my IOS application currently using about 1000 users. So the users do not want update his app. The question is - any option to implement Azure notification hub in IOS application without updating the App.? In my hand device Id stored in DB. And also I have certificates.
I think write a console application and add all device id to azure notification hub. Is it possible?
Per my experience, it seems to be not possible to migrate from APNS to Azure Notification Hub for your iOS app without any code changes, because you must have to add the Nofication Hub ListenSharedAccess connect string into your app project. Actually, the architecture migration for your app is from Fig 1 to Fig 2, as below, it will cause necessary code changes. Unless there is some mechanism of hot-patching in your app, but it was not allowed by Apple.
Fig 1.
Fig 2.
Yes, you can register all your existing device tokens with the Notification Hub using the API of your choice. Then have your app back-end register new tokens with the notification hub as they come in.
I have been tasked to add push notification for a web site being developed. Never done one before. I spent a long time googling this and I am not much closer than when I started searching, mostly because most articles describe specific details.
The web application is an intranet app and they are asking for things like when a new report is made available, let the users know about it; or basically any kind of organization/department announcements.
Can someone tell me what are the components involved in developing/deploying this type push notifications? If I know what the pieces are that make this process possible, I can take it from there. I must mention that this web application is being designed to be available on devices (desktop, tablets and phones; if this makes any difference in design/development).
You can try OneSignal Push Notification
in this you can send notifications to websites,android app and ios app
You can also check the documentation for sending notifications to website here
Hope this helps:)
I'm trying to implement my C# backend's communication with Notification Hub. I've read almost every tutorial about Azure Notification Hub, and I can't find a decent tutorial that explains what actually corresponds to what. I think there are two ways of representing a device (from what I've understood): an Installation and Registration, and Installation seems to be newer and more preferred.
However, when I get into Installation, I get more questions in my mind:
What is InstallationId? Is it something that I create, or something that I get from somewhere, either device or PNS.
Do I need to set up ExpirationTime, or does it default to longest (it says 90 days is the longest)? What if I want it to be longer than 90 days?
What is PushChannel? Is it, just like InstallationId, something that I create, or get from somewhere?
How are templates exactly used?
Out of all these variables, which one is the actual device push token that I get at the client?
I usually don't ask those kind of questions that seek for a tutorial-ish answers and have multiple questions, but I've tried to search everywhere, but the more I search, the more it gets complicated and I don't even know where to start. Any answer would be a good starting point to anyone trying to learn Notification Hubs, just like me.
InstallationId is an abstraction on top of device token/key/channel etc. It's a unique id that you create when you 'install' a device (or user if your OS/platform allows separate tokens for multiple users). This is an id you can use to associate tags, templates etc with the device. You create an installation once and then keep the id somewhere in the local storage and then make updates to the installation associated with the id if you need to.
You don't need to explicitly set ExpirationDate. I think in the past tokens on most platforms used to expire, so this was a way to let Notification Hubs know when not to try to push to the token. I believe now it's not the case. So what happens is if Notification Hubs cannot deliver a notification to a device for a number of times, it just deletes the registration by itself.
Has this post on templates been useful?
PushChannel stands for 'The channel URI if registering the installation for WNS; Device Token if registering for APNS.'
Let me know in the comments if I can clarify any of these and I'll update the answer.
There is actually a 3rd option besides Installation and Notification: DirectSend.
The Direct-Send technique is less of an abstraction than Installation and Notification. With Direct-Send you can send notifications directly to one or more specific devices. Basically you use the actual deviceToken- as in what #NikitaG notes for PushChannel.
If you need to be able to decide specifically when your back-end application pushes to a specific-device-A-but-not-B vs. pushing to a specific-device-B-but-not-A vs. specific-device-A-and-specific-device-B according to some schedule Direct-Send can be enabling.
I'd listed some of the resources discussing Direct-Send at Azure Notification Hubs Send Notification to Specific Device.