Pushnotifications in windows phone app 8.1? - windows-phone-8

I want to send pushnotifications to windows phone.
string subscriptionUri = "https://hk2.notify.windows.com/?token=AwYAAAAqksei6yWvmlcV8RmESRNrXotwCWV0AY9PSOtmgpIo%2bNwq67tkYjG7450r%2bUKpLwxri%2bO7Re9%2f8qmZDAc3TmTlMOaONVqq9ogCKONX2oWe%2fVq%2bT9tIxEllJW3tnKJEfNM%3d";
//string subscriptionUri = "http://s.notify.live.net/u/1/hk2/H2QAAACfgMkOSS8jNp_XgLamnXFqQrk6g8L6pRJHsQxvppe8-lD4EgCu8LcwdtuDIGnY78tjyaL1lsFxLjWl5s-Sgum5tjBQMk-9emm73LJa9125iECyFCoPb5erRBRwGAgNv2o/d2luZG93c3Bob25lZGVmYXVsdA/jGFxihnYNUOIt5Q4gABT7Q/T4l1SvWZqMi_mEe4F61sx-CINOg";
in the above two channeluris first one is Windows RT app uri,second one is Silverlight app uri.Iam getting notification whenever silverlight app uri used.but I am not getting notification whenever windows RT app uri used.whenever
I am sending windows RT app uri to the server then response is "OK" but not getting any notification to my device.please help me.

Have you enabled toast notification? In Package.appxmanifest, Under Application tab there is "Notifications" option "Toast Capable" set it to "yes"

One more possibility is the subscription uri is getting decoded at the receiving end.

Related

WP8.1 silverlight - Notification activated event not being called

I am working on a Windows Phone 8.1 silverlight app, raw notifications handling.
The App when receives notifications in foreground, has to cancel the notification and create a new notification using ToastNotificationManager.CreateToastNotifier().
It also has a backgroundtask to work on the raw notifications received in background, which converts the raw notifications received to toast notification using ToastNotificationManager.CreateToastNotifier().
Also some action A needs to be performed on clicking of this notification.
The issue arises when the App receives the notification when in foreground, but the notification is clicked after suspending the application. Since the registered activated event of such type of notification is not in the background task (because the notification was formed in the foreground logic), no action A is performed on clicking of the notification.
This seems to a limitation, for WP8.1 silverlight apps. Can somebody suggest a solution for this issue??
If you need to do some action after tap on Toast you should add wp:Param to your Toast with deep url and handle in you app.
Toast will be look like
<wp:Notification xmlns:wp=\"WPNotification\">
<wp:Toast>
<wp:Text1>You title</wp:Text1>
<wp:Text2>Your subtitle</wp:Text2>" +
<!-- You can add any parameter you want in deep url -->
<wp:Param>/Page2.xaml?NavigatedFrom=Toast Notification</wp:Param>
</wp:Toast>
</wp:Notification>
When you tap on toast it by default will open Page2.xaml of your app and pass uri parameters to it

Push Notification not getting in windows phone app 8.1RT? [duplicate]

I want to send pushnotifications to windows phone.
string subscriptionUri = "https://hk2.notify.windows.com/?token=AwYAAAAqksei6yWvmlcV8RmESRNrXotwCWV0AY9PSOtmgpIo%2bNwq67tkYjG7450r%2bUKpLwxri%2bO7Re9%2f8qmZDAc3TmTlMOaONVqq9ogCKONX2oWe%2fVq%2bT9tIxEllJW3tnKJEfNM%3d";
//string subscriptionUri = "http://s.notify.live.net/u/1/hk2/H2QAAACfgMkOSS8jNp_XgLamnXFqQrk6g8L6pRJHsQxvppe8-lD4EgCu8LcwdtuDIGnY78tjyaL1lsFxLjWl5s-Sgum5tjBQMk-9emm73LJa9125iECyFCoPb5erRBRwGAgNv2o/d2luZG93c3Bob25lZGVmYXVsdA/jGFxihnYNUOIt5Q4gABT7Q/T4l1SvWZqMi_mEe4F61sx-CINOg";
in the above two channeluris first one is Windows RT app uri,second one is Silverlight app uri.Iam getting notification whenever silverlight app uri used.but I am not getting notification whenever windows RT app uri used.whenever
I am sending windows RT app uri to the server then response is "OK" but not getting any notification to my device.please help me.
Have you enabled toast notification? In Package.appxmanifest, Under Application tab there is "Notifications" option "Toast Capable" set it to "yes"
One more possibility is the subscription uri is getting decoded at the receiving end.

Send a Toast Notification from windows universal Application

I am trying to find a way to send a toast notification from a windows universal application. The Azure documentation does mention a way to do this from a Console Application. This does not meet my use case though, where I want to send toast notifications from a windows universal application. The problem is the nugget package Microsoft.Azure.Service.Bus is not compatible with a windows store or windows phone 8.1 application.
Is there any Windows Azure library that will allow me to send a toast notification from Windows universal application.
Typically you wouldn't send the toast from the Universal app. You would send the toast to the app to let the user know that something occurred on the server.
If you want to schedule a toast from the app to the local system then you don't need Azure (or another web service). You can schedule that directly with a scheduled notification. See Quickstart: Sending a toast notification (XAML) and How to schedule a toast notification (XAML)
If you want to push a notification elsewhere then you can set up an Azure Notification Hub and connect to it through its REST service via the HttpClient class.
More typically though your app would contact your back-end server to connect to the notification hub. This can be readily set up with an Azure Mobile Service. See Add push notifications to your Mobile Services app
Bellow two basics samples:
Sample 1 text only
const ToastTemplateType toastTemplate = ToastTemplateType.ToastText01;
var toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
var toastTextElements = toastXml.GetElementsByTagName("text");
toastTextElements[0].AppendChild(toastXml.CreateTextNode("Hello World!"));
var toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier().Show(toast);
Sample 2 text and image
const ToastTemplateType toastTemplate = ToastTemplateType.ToastImageAndText01;
var toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
var toastTextElements = toastXml.GetElementsByTagName("text");
toastTextElements[0].AppendChild(toastXml.CreateTextNode("Hello World!"));
var toastImageAttributes = toastXml.GetElementsByTagName("image");
((XmlElement)toastImageAttributes[0]).SetAttribute("src", "https://i.stack.imgur.com/wzdIt.jpg");
var toast = new ToastNotification(toastXml);
ToastNotificationManager.CreateToastNotifier().Show(toast);
Toast notifications are small pop ups that appear on the screen for few seconds. They convey messages and can be customized to even play different sounds.
See the Windows Universal Apps notifications sample for more.

Modify user-agent WP8

In my windows phone 8 app, I call to external APIs developed by client may be in PHP.
They told us that the user agent is showing NativeHost.
They want it to be Windows Phone so that they could better track the windows phone requests.
Try setting the HttpWebRequest.UserAgent property.
Tr this one
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Add("User-Agent", "my-user-agent-name");
Hope you are using HTTP client to make call to external API

windows phone 8 app for sending SMS from windows phone

I am developing a simple windows phone 8 app using visual studio express 2012 and WP8 SDK using C# and SQLite. I would like to know how to send SMS or email to various recipients using this app with my windows phone (I do not want to send SMS through internet )
thanks a lotttt :)
You can't send an SMS or an email (from system account) without user approval. To do that use Launchers:
Email: Use EmailComposeTask: How to use the email compose task for Windows Phone
SMS: Use SmsComposeTask: How to use the SMS compose task for Windows Phone
They both shows popup and ask user to approve the message to be send.
in windows phone 8.1 i use the following code in C#:
ChatMessage chatMessage = new ChatMessage();
chatMessage.Body = "Text message";
chatMessage.Recipients.Add("phonenumber");
await ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage);
Hope it helps :)