Signal the receipt of messages

Asked

Viewed 228 times

1

The customer has 7 stores and a headquarters. Someone in the matrix with decision power, will keep your mobile in hand with an app. When an employee of one of the stores needs to approve a higher discount than she can give, she then sends a request via this app, via REST and on the other side the manager receives this request and based on the information that the service brings to him, will approve or not. How would I get this message to the person who has the app? In reality, message that I say is to notify the client who uses the App that has negotiation, he then should open the App, and at that time consume the REST and authorize or not. It’s not a chat.

  • you can use Signalr, this way the web application can send a message to mobile devices.

  • I would make the service send a push to the device, and at that push you would send a payload with the information so that, when opening an Activity by the notification Pendingintent, you would consult in the service what you needed and make the authorization. When authorizing, it would send another push, but to the original Nder and it would release the sale.

  • The question is how the App user will know whether or not there is a message? In my Linkedin App or What’s App, for example, if I have 3 notifications, there is on top of the App icon an orange or green "ball" or any other color, with the amount of messages indicated. Signalr does this or what the CDS posted?

  • I think I asked the question in the wrong way. I’ll redo it

  • No problem. In this case you would have to treat the pending releases internally in the app, storing a list of pending releases. And in the case of push, you can show the notification the way you want in the app. This ball that appears in the app is native to the platform or Launcher that uses. It only counts pending notifications from the app, but doesn’t work on all Androids. This library can help you https://github.com/leolin310148/ShortcutBadger

1 answer

1


You can use Azure Notification Hub to do so. So you can generate the notification for any platform.

In my github you can see a example of sending notifications.

In your app, you sign in to receive notifications:

var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();

var hub = new NotificationHub("NOME_DO_SEU_APP", "Endpoint=sb://NOME_DO_SEU_APP.servicebus.windows.net/;SharedAccessKeyName=DefaultListenSharedAccessSignature;SharedAccessKey=CHAVE_COMPARTILHADA_DO_SEU_APP");
        await hub.RegisterNativeAsync(channel.Uri);

And on your REST service, vc triggers the notifications:

var hub = NotificationHubClient
            .CreateClientFromConnectionString("Endpoint=sb://NOME_DO_SEU_APP.servicebus.windows.net/;SharedAccessKeyName=DefaultFullSharedAccessSignature;SharedAccessKey=CHAVE_DO_SEU_APP",
            "NOME_DO_SEU_APP");

var toast = @"<toast><visual><binding template=""ToastText01""><text id=""1"">Bem vindos ao VSSummit 2015</text></binding></visual></toast>";
var toastWithImage = @"<toast><visual><binding template=""ToastImageAndText01""><image id=""1"" src=""https://cdn1.iconfinder.com/data/icons/metro-ui-icon-set/512/Visual_Studio_2012.png"" /><text id=""1"">Bem vindos ao VSSummit15!</text></binding></visual></toast>";
hub.SendWindowsNativeNotificationAsync(toast).Wait();
  • Thiago, I will do the tests and soon put. So I have not yet marked your answer. Need to install via Nuget these namespaces?

  • Yes, you can see it on the github address I have. There are the pkgs. :)

  • Thiago, use vs2017 and is giving incompatible App2. How do I open your project?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.