React native azure notification hub - azure

I am using this library to implement azure notification hub in react native.
I am able to get the registration ID successfully. But no notification is received.
I am sending test notification from azure portal and it is getting delivered successfully.
I am followed the integration tutorial from here and here.
In my manifest file i am getting this error in red. Could be the reason.
If yes, How do i resolve this ?

I followed the same steps and had the same issue with com.microsoft.windowsazure.notifications.NotificationsBroadcastReceiver being unreferenced. I was able to resolve by adding
dependencies {
...
implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.6#aar'
implementation 'com.microsoft.azure:azure-notifications-handler:1.0.1#aar'
}
repositories {
maven {
url "https://dl.bintray.com/microsoftazuremobile/SDK"
}
}
to my app build.gradle as outlined here
It may or may not make a difference but also make sure you have the x86 Atom image installed to the project

Related

.Net Maui iOS app with Push Notifications WillPresentNotification or DidReceiveNotificationResponse never gets called

I'm able to call RegisterForRemoteNotifications(); from the AppDelegate to get the Token. I'm then using an APN server I built to update Apple Passes. I'm sending a message with the correct payload, headers etc..., but nothing ever happens.
I'm assuming that something needs to be added to MauiProgram.cs in order to get this to work.
Seeing as I have my own APN server, I really don't want to use Firebase or Azure Notification Hub at this time. A Firebase method is provided in the following link.
[https://cedricgabrang.medium.com/firebase-push-notifications-in-net-maui-ios-2f4388bf1ac][1]
Seeing as Local Notifications and Remote Notifications use the same methods, I modeled my code after this example.
https://github.com/xamarin/xamarin-forms-samples/tree/main/LocalNotifications
Here is my code with some decorations.
// Called if app is in the foreground.
[Export("userNotificationCenter:willPresentNotification:withCompletionHandler:")]
public override void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
{
SentrySdk.CaptureMessage("WillPresentNotification = " + "yes");
ProcessNotification(notification);
completionHandler(UNNotificationPresentationOptions.Alert);
}
// Called if app is in the background, or killed state.
[Export("userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:")]
public override void DidReceiveNotificationResponse(UNUserNotificationCenter center, UNNotificationResponse response, Action completionHandler)
{
SentrySdk.CaptureMessage("DidReceiveNotificationResponse = " + "yes");
if (response.IsDefaultAction)
{
ProcessNotification(response.Notification);
}
completionHandler();
}
NOTE: I'm compiling my iOS app using an Azure DevOps Pipeline. I've added both the Development cert and the Push Notification cert to the Keychain. I don't see the Push Notification cert included in the DotNetCoreCLI#2 Task. Push Notifications are enabled and configured in the Provision Profile. Perhaps there is a problem with the build process and how the Keychain installs/uses the all the certs.
Does anyone know how to make this work? Seems like this should be pretty easy to do.
I finally got this working using the Firebase.plugin for .Net Maui. My APN server works. The Firebase console works too.
I used these directions.
https://cedricgabrang.medium.com/firebase-push-notifications-in-net-maui-ios-2f4388bf1ac
If you are having issues getting Firebase.plugin to build on iOS, take a look at this issue. https://github.com/TobiasBuchholz/Plugin.Firebase/issues/51
Here is the code I used in my Azure Pipeline to combine the two Apple Certs. https://stackoverflow.com/a/74105887/5360237

Creating a main account twilio client on a subaccount node function

I'm developing a twilio function on a subaccount that needs to acces a twilio client on the main account. The function is being deployed through a Github action to the subaccount.
For this, on the subaccount function I have:
const mainClient = new twilio(context.MAIN_TWILIO_ACCOUNT_SID, context.MAIN_TWILIO_AUTH_TOKEN);
Then I need to access serverless.services but I'm getting serverless undefined therefore can't access services.
i.e.
return mainClient.serverless.services(...
I tested code locally and it worked but failed on deployment. Is it possible to access services on main account from a subaccount function??
Thanks.
For anyone experiencing a similar issue.
My problem was that deploying without being explicit about dependencies doesnt install the latests version of dependencies.
Deploy through github installed twilio node sdk version 3.29.0 but this version doesn includes serverless api yet. So I explicitly added latest twilio node sdk (3.75.0 at the moment) and that fixed the problem.
Thanks.

Swashbuckle for Azure Functions v3: failed to load API definition

I created a simple project where I added the latest version of the extension. I published my code on Github. I use Azure Functions v3. The dependencies are:
AzureExtensions.Swashbuckle 3.1.6
AzureFunctions.Extensions.Swashbuckle 1.4.4
Microsoft.NET.Sdk.Functions 3.0.3
I followed the steps on theSwashbuckle page. Locally is working. When I publish the function on Azure, I get this error:
{
"schemaValidationMessages": [
{
"level": "error",
"message": "Can't read from file https://azuks-test-q001.azurewebsites.net/api/swagger/json"
}
]
}
Before this, I faced another issue that I asked here. I can't understand what changed.
Update
For same reason, the code param can't be the same for json and UI. If you open your Swagger url with Get Function url and copy the url from UI function, it is working.
Currently only fork => https://github.com/vitalybibikov/azure-functions-extensions-swashbuckle
supports your version of Azure Functions, (which is v3)

dynamic_template_data doesn't work with sendgrid and azure function integration

Trying to use transactional template with azure function sendgrid integration (javaScript) , I'm sending the following object (removed email address etc.):
const message =
{
"personalizations":[
{
"to":[
{
"email":"[MY_EMAIL]",
"name":"Rotem"
}
],
"dynamic_template_data":{
"rotem_test1":"wow"
}
}
],
"from":{
"email":"[FROM_EMAIL]",
"name":"name"
},
"reply_to":{
"email":"[REPLY_EMAIL]",
"name":"name"
},
"template_id":"[CORRECT_TEMPLATE_ID]",
"tracking_settings":{
"click_tracking":{
"enable":true
}
}
}
context.done(null,message);
also tried using context.done(null,JSON.stringify(message)) with the same result:
I get an email from the correct template but without any substitution.
when sending the exact same object using the https://api.sendgrid.com/v3/mail/send
API using postman everything works well.
would love to get help here as for what I'm doing wrong on my azure function.
You did everything correctly as you can receive email as expected.
Problem is caused by the SDK version. Property dynamic_template_data has just been added in latest 9.10.0 Sendgrid C# SDK, but the binding extension still uses old version, which has no idea what dynamic_template_data is.
For 2.x function(Check Function app settings on Azure portal, see Runtime version: 2.xxx (~2)), we can install new version SDK manually before the extension is updated.
If you develop locally
Go to function project directory, delete bin, obj folder.
Edit extensions.csproj under function project, add latest version Sendgrid <PackageReference Include="Sendgrid" Version="9.10.0" />.
In this directory open console(terminal,Powershell,etc), input func extensions install to restore packages.
Else on Azure portal
Stop the function app.
Access kudu console through Platform Features -> Advanced Tools(Kudu) -> Debug Console (CMD)
Navigate to D:\home\site\wwwroot
Delete the bin directory
Edit extensions.csproj, add <PackageReference Include="Sendgrid" Version="9.10.0" /> and Save the changes.
In console below, input dotnet build extensions.csproj -o bin --no-incremental --packages D:\home\.nuget
After you see Build succeeded, start the function app.
For 1.x function(Runtime ~1), I am afraid we have to manually send email using with sendgrid node module, Sendgrid vesion in 1.x function is locked therefore can't be updated.

GCM With Xamarin.ios

I have implemented GCM with Xamarin.ios , I am able to get Device Token and GCM ID , But i am not able to recive Notification sent by Push sharp library . I am seeing log and i am getting below issue.Can this be reason of not receiving notification ?. Also we are new in Xamarin ,It will be hlpful if somebody can help us with podfile.
You have enabled the CloudMessaging service in Developer Console, but it appears as though your Podfile is missing the line: 'pod "Google/CloudMessaging" or you may need to run pod update in your project directory.
You need to add this component and implement it in your AppDelegate There are code examples of how to do so in the Getting Started section.
You need to add this component and implement it in your AppDelegate There are code examples of how to do so in the Getting Started section.

Resources