push notifications in Windows Phone - windows-phone-7

I've implement a Project to send push notifications to a Windows phone application.
The notification coming succesfully in the emulator or i'm running the app to send to a different emulator and the app to receive to another emulator and it Works fine.
The problem is that the notification is not coming to the telephone device.
Is there a restriction or any other issue to check?

I think that you should set the variable channelname via ToastSampleChannel, so, the field private const String ChannelName = "MyChannel" should be changed accordingly.
private const String ChannelName = "ToastSampleChannel"

Related

Azure NotificationHubs how do I get the devicetoken from an iPhone

I am using Azure NotificationsHubs for iOS push notifications and want to get the deviceToken to register the device, along with the user, in a table through an api so I can send notifications to specific users/devices and keep track of badge counts. When not using Azure Notification Hubs.
func application(
_ application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
print("DeviceToken: \(deviceToken)")
}
I see the documentation says:
By default, the SDK will swizzle methods to automatically intercept
calls to UIApplicationDelegate/NSApplicationDelegate for calls to
registering and intercepting push notifications, as well as
UNUserNotificationCenterDelegate methods. Note this is only available
for iOS, watchOS, and Mac Catalyst. This is not supported on macOS and
tvOS.
I'm not sure what swizzling means but I don't want to disable what I have working thus far. Is there another way within the standard implementation to get the deviceToken?
I also see this in the documentation:
To target a particular user on the backend, you can specify a tag such as $UserId:{VALUE} where VALUE is the user name you have specified, just as you can target an installation using the $InstallationId:{VALUE} tag.
But how do I get the InstallationId and is that different from the deviceId or value I use in xcrun simctl push? I expect somewhere I will need to store it on the server side and associate it with a user or something.
I read this post which states:
When you send a notification from the server, one of the paramters is the device ID.
I could do it by user only, but what if they want different notification preference for different devices?
I expect to send to a specific user on a specific device from the server you would use tags, for example:
Microsoft.Azure.NotificationHubs.NotificationOutcome outcome = null;
String userTag = "(UserId:xxxx)";
// substituting for iOS
var toast = "{\"aps\":{\"alert\":\"This is a test\"}}";
outcome = await Notifications.Instance.Hub.SendWindowsNativeNotificationAsync(toast, userTag);
On the client, I am setting the user id like this:
let userId = "xxxx"
MSNotificationHub.setUserId(userId);
Even without the device id part of it, I can't get the user part working. I can send a notification without any tags, but I add in the user tag and it does not work. I assumed by calling setUserId that would add a tag, based on the links above.

one signal sdk setup for sending push notification to a particular registered android or ios device

I am very new to xamarin apps, can anyone please tell me how to setup one signal push notification for android and ios. I am able to achieve notification for all the registered device but i want to send notification to a particular registered device. How to achieve this in xamarin android and ios.
If I understood your question right, you want to attach the user data stored on your system by id or email to the device UUID acquired by OneSignal so that you can then target a user from your backend via the OneSignak API.
Xamarin has nothing to do for this, but sending the device UUID to your App backend while the user is logged in, and your App backend should store the UUID with the user data.
void SomeMethod() {
OneSignal.Current.IdsAvailable(IdsAvailable);
}
private void IdsAvailable(string userID, string pushToken) {
//here you can send the userID along with stored login token
//or any kind of id to your backend
}
for more info
https://documentation.onesignal.com/docs/xamarin-sdk

How to use Background agent to send toast notification?

I am working on windows development & I am displaying the items on the emulator by using a web service.
Now I want to send a toast notification when an item added to the service. Already I worked with push notifications. But It’s generating push channel URL when app is initialized.
I don’t want to use this channel URL. So I tried Background Agent & Shell Toast to send the notification. Its working fine for static data. How can I add dynamic data to back ground agent which is coming from web service?
One more thing is, there are two things like PeriodicTask & ResourceIntensiveTask. How can I use this to send a toast notification by using Background Agent?
You can refer to this Tutorial From Nokia
http://developer.nokia.com/community/wiki/How_to_create_simple_Background_Agent_in_Windows_Phone
and this from CodeProject
http://www.codeproject.com/Articles/656654/Windows-Phone-Background-Agent-Part-Periodic-T

Register custom app as default for handling sms sending and receveing

Register custom app as default for handling sms sending and receveing in windows phone
This is not possible with the current Windows Phone SDK. You can vote on the official Windows Phone Dev Feedback to indicate your interest in an SMS Access API.
The only thing you can do with the current SDK is launch the default SMS app with a predefined number and text:
SmsComposeTask smsComposeTask = new SmsComposeTask();
smsComposeTask.To = "2065550123";
smsComposeTask.Body = "Your text";
smsComposeTask.Show();
You can send SMS using the above mentioned method.But you cannot receive SMS in windows phone.
It is possible only in Windows Mobile platforms.
As far as I am aware, you cannot change the default apps in Windows Phone.
And addition. You'r program is being run in a sandbox - closed space for you'r application only. That means you cannot run/modify etc other 3 party programms. Only the default programs like Calculator and etc. are awailable

Is EmailComposeTask Class already working?

For example here:
http://msdn.microsoft.com/en-us/library/ff769550(VS.92).asp
EmailComposeTask emailComposeTask = new EmailComposeTask();
emailComposeTask.To = "user#example.com";
emailComposeTask.Body = "Email message body";
emailComposeTask.Cc = "user2#example.com";
emailComposeTask.Subject = "Email subject";
emailComposeTask.Show();
I read it doesnt work yet.
I have a real device, and an application in the marketplace - it is definitely working. The reason it doesn't work on an emulator is that you can't set up an email account on the emulator, and the first step of the email compose task when it is run is to prompt the user to select which email account to send the email with (if you've got more than one)
Since you can't set one up on the emulator, it kicks back and you can't send an email.
The only way to test this (for now) is to debug on an actual WP7 device, but I can 100% guarantee this is working.
One thing to note about the email tasker is that you can't programmatically add attachments...yet.
Yes, it works on real devices (not on the emulator)
Just pasted your code into an app, deployed to a device and was presented with a choice of which of my email accounts I wanted to use for the email after which the email was prepared ready editing and sending.

Resources