It took me some time to figure this out so:
First create the templates for Android and IOS:
Android:
private static string TodoCreated = "{\"data\":{\"title\":\"$(Title) + \' was created! \'\", \"text\":\"$(Description)\", \"ID\":\"$(ID)\"}}";
IOS:
private static string TodoDeleted = "{\"aps\": {\"alert\":\"{$(Title) + \' was deleted! \'}\"}, \"id\":\"$(ID)\"}";
Then add two tags to it. First the Azure UserID and then the template name that you registered the template with.
Then in the backend project just connect these two with && and thats it.
string userTag = authenticatedUser.Id;
List<string> tags = new List<string>();
tags.Add(userTag+"&&TodoCreated");
Really easy and flexible solution. It makes it super easy to subscribe to only certain pushnotifications for example.
First create the templates for Android and IOS:
Android:
private static string TodoCreated = "{\"data\":{\"title\":\"$(Title) + \' was created! \'\", \"text\":\"$(Description)\", \"ID\":\"$(ID)\"}}";
IOS:
private static string TodoDeleted = "{\"aps\": {\"alert\":\"{$(Title) + \' was deleted! \'}\"}, \"id\":\"$(ID)\"}";
Then add two tags to it. First the Azure UserID and then the template name that you registered the template with.
Then in the backend project just connect these two with && and thats it.
string userTag = authenticatedUser.Id;
List<string> tags = new List<string>();
tags.Add(userTag+"&&TodoCreated");
Really easy and flexible solution. It makes it super easy to subscribe to only certain pushnotifications for example.
Keine Kommentare:
Kommentar veröffentlichen