<div dir="ltr">Hi Dharmendra,<div><br></div><div>So in the first case:</div><div>Install the aerogear-windows-push nuget package in your windows mobile app:</div><div><br></div><div>PM> Install-Package aerogear-windows-push<br></div><div><br></div><div>Install UPS and create an application and a mpns varaint then add the following to your windows app:</div><div><br></div><div><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:0px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)"><span class="" style="color:rgb(167,29,93)">protected</span> <span class="" style="color:rgb(167,29,93)">override</span> <span class="" style="color:rgb(167,29,93)">void</span> OnNavigatedTo(NavigationEventArgs e)
{
PushConfig pushConfig = <span class="" style="color:rgb(167,29,93)">new</span> PushConfig() {
UnifiedPushUri = <span class="" style="color:rgb(167,29,93)">new</span> Uri(<span class="" style="color:rgb(24,54,145)"><span class="">"</span><span class="">"</span></span>), VariantId = <span class="" style="color:rgb(24,54,145)"><span class="">"</span><span class="">"</span></span>, VariantSecret = <span class="" style="color:rgb(24,54,145)"><span class="">"</span><span class="">"</span></span>
}; <span class="" style="color:rgb(150,152,150)">//[1]</span>
Registration registration = <span class="" style="color:rgb(167,29,93)">new</span> MpnsRegistration();
registration.PushReceivedEvent += HandleNotification;
registration.Register(pushConfig);
}
<span class="" style="color:rgb(167,29,93)">void</span> HandleNotification(<span class="" style="color:rgb(167,29,93)">object</span> sender, PushReceivedEvent e)
{
Debug.WriteLine(e.Args.Message);
}</pre><br></div><div>Fill out [1] with the location of your UPS and the id and secret from your Mpns variant</div><div><br></div><div>If you have done that correctly you'll see a installation on the UPS console. Now you can use the Java Sender to send a message to UPS that will in turn send it to your device.</div><div><br></div><div><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;color:rgb(51,51,51);background-color:rgb(247,247,247)"><code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:3px;border:0px;display:inline;max-width:initial;overflow:initial;line-height:inherit;word-wrap:normal;background:transparent">PushSender defaultPushSender = DefaultPushSender.withRootServerURL("<a href="http://localhost:8080/ag-push">http://localhost:8080/ag-push</a>")
.pushApplicationId("c7fc6525-5506-4ca9-9cf1-55cc261ddb9c")
.masterSecret("8b2f43a9-23c8-44fe-bee9-d6b0af9e316b")
.build();</code></pre></div><div>See:</div><div><a href="https://github.com/aerogear/aerogear-unifiedpush-java-client">https://github.com/aerogear/aerogear-unifiedpush-java-client</a></div><div><a href="https://github.com/aerogear/aerogear-windows-push">https://github.com/aerogear/aerogear-windows-push</a><br></div><div><a href="https://aerogear.org/docs/unifiedpush/ups_userguide/index/">https://aerogear.org/docs/unifiedpush/ups_userguide/index/</a><br></div><div><br></div><div>Other case without UPS</div><div><br></div><div>Register your app with Mpns yourself have a look at the source code of the aerogear-windows-push to see how to register:</div><div><br></div><div><div> const string channelName = "ToastChannel";</div><div><br></div><div> var channel = HttpNotificationChannel.Find(channelName) ?? new HttpNotificationChannel(channelName);</div><div><br></div><div> var tcs = new TaskCompletionSource<string>();</div><div> channel.ChannelUriUpdated += (s, e) => { tcs.TrySetResult(e.ChannelUri.ToString()); };</div><div> channel.ErrorOccurred += (s, e) => { tcs.TrySetException(new Exception(e.Message)); };</div><div><br></div><div> channel.ShellToastNotificationReceived += PushChannel_ShellToastNotificationReceived;</div><div><br></div><div> channel.Open();</div><div> channel.BindToShellToast();</div><div> return await tcs.Task;</div></div><div><br></div><div>Use java-mpns in your app directly to send a message to the device:</div><div><br></div><div><ol style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:16px;line-height:25.6px"><li><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;background-color:rgb(247,247,247)"><code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:3px;border:0px;display:inline;max-width:initial;overflow:initial;line-height:inherit;word-wrap:normal;background:transparent">MpnsService service = MPNS.newService().build();</code></pre></li><li><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;margin-top:0px;margin-bottom:16px;font-stretch:normal;line-height:1.45;padding:16px;border-radius:3px;word-wrap:normal;background-color:rgb(247,247,247)"><code style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.6px;padding:0px;margin:0px;border-radius:3px;border:0px;display:inline;max-width:initial;overflow:initial;line-height:inherit;word-wrap:normal;background:transparent">MpnsMessage notification = MPNS.newMessage()
.tile().count(2).title("Tile message")
.build();
String subscriptionUri = "https://..../" //need to get this from the device
service.push(subscriptionUri, notification);</code></pre></li></ol></div><div>Downside to this approach is that when you have other clients like android or ios then you'll need to manage the dispatching yourself that is where UPS is handy and you need a way to get the subscriptionUri from the device to your java backend.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 10, 2015 at 2:08 PM, Dharmendra Sahu <span dir="ltr"><<a href="mailto:dharmendra.sahu08@hotmail.com" target="_blank">dharmendra.sahu08@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr"><div>Hello,</div><div><br></div><div>I have gone through your api and server and I want to use in my application.</div><div>I have created windows mobile application.</div><div>I want to use java-mpns api for push notification.</div><div>I want to send push notification message from my java web-application to AeroGear UnifiedPush Server and Unified server to my windows mobile application.</div><div><br></div><div>OR</div><div><br></div><div>I would like to know if we could send push notification from my java web application to my windows mobile application.</div><div><br></div><div>Thanks for your support and help.</div><div><br></div><div>Thanks</div><span class="HOEnZb"><font color="#888888"><div>Dharmendra Sahu</div><div><br></div>                                            </font></span></div></div>
<br>_______________________________________________<br>
Aerogear-users mailing list<br>
<a href="mailto:Aerogear-users@lists.jboss.org">Aerogear-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-users" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Cheers,<div> Erik Jan</div></div></div>
</div>