How to test Windows Phone 8.1 push notifications? - push-notification

I'm searching google for something to test push notifications to Windows Phone 8.1, either an outline of what's required to make one or a pre-built test application.
Most of the results I'm finding relate to Windows Phone 8 and Windows Phone Silverlight 8.1.
As this is only for test, the unauthenticated service would more than suffice.

These appear to be the answer:
http://code.msdn.microsoft.com/windowsapps/Action-Center-Quickstart-b15089f2
http://code.msdn.microsoft.com/windowsapps/push-and-periodic-de225603
To add to this, you can test sending the Notifications to the phone using the emulator,
e.g. (http://i.imgur.com/uykCO1W.png <-- higher res image)

Something that helped me was putting:
await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
just before:
BackgroundTaskBuilder builder = new BackgroundTaskBuilder();
builder.Name = backgroundTaskName;
builder.TaskEntryPoint = typeof(WindowsRuntimeComponent1.MyTask).FullName;
builder.SetTrigger(new PushNotificationTrigger());
builder.Register();
Now, open the 'tools' dialog from your emulator and select the 'Notifications' tab. Check the 'simulator' box.
IMPORTANT: Uninstall the app from the emulator then re-run it from visual studio. Once the app runs you should see your AppId and URI(if you don't then click the 'Refresh' button) in the 'Tools' dialog. You should now be able to set what type of notification you want and the payload text. I hope this helps.

If you have account details mange push noficaion via web

Related

Cannot get token from Huawei HMS push kit

error message as below
[getToken] Error/Exception: {"nativeStackAndroid":[],"userInfo":null,"message":"907122036: no
right","code":"907122045","line":2568,"column":45,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.huaweipush.letsapp&modulesOnly=false&runModule=true"}
[getToken] Error/Exception: {"nativeStackAndroid":[],"userInfo":null,"message":"907122036: no right","code":"907122045","line":2568,"column":45,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.huaweipush.letsapp&modulesOnly=false&runModule=true"}
The error code indicates that the Push Kit are not enabled. As a result, have no permission to obtain the token. How to enable the Push Kit, pls refer to the this docs.
Sign in to AppGallery Connect and click My projects.
Find and click the desired project in the project list, and click the app for which you need to set Push Kit parameters.
Go to Project settings > Manage APIs and enable Push Kit.
Go to Grow > Push Kit and click Enable now. In the dialog box that is displayed, click OK.
Enable the precise messaging function.
Here below is some checkpoints for the above issue.
First ensure you have enabled the push kit in AppGallery Console
Please check whether you are providing correct app id or not:
String appId = AGConnectServicesConfig.fromContext(MainActivity.this).getString("client/app_id");
pushtoken = HmsInstanceId.getInstance(MainActivity.this).getToken(appId, "HCM");
It is recommended that the getToken method be called in the onCreate method of the first Activity class after app startup. Implement the corresponding listeners for getToken API and observe the logs.
Device: Non-Huawei phones must have HMS Core (APK) installed (which can be downloaded from HUAWEI AppGallery). There is no restriction on Huawei phones.
Network: The phone is connected to the network and the connection is stable.
EMUI version: EMUI 4.0 and EMUI 4.1 (for some devices), and EMUI 5.0 or later It is recommended that you use a device running EMUI 5.0 or later.

iOS 12 and above, fetch Wifi SSID to which iPhone is connected

I have gone through the link which explains getting SSID without private library. This works for devices below iOS 12.0.1. From iOS 12.0.1 onwards, the same library is not beneficial anymore. My code snippet is:
CFArrayRef myArray = CNCopySupportedInterfaces();
CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
NSString *networkName = CFDictionaryGetValue(myDict, kCNNetworkInfoKeySSID);
These lines crash in Xcode 10 and above. myDict is returned nil. Is the library changed? Any other way to achieve this task?
Additional settings are reqiured in iOS12 for getting Wifi SSID.
Summary is that Apple qoutes:
To use this function in iOS 12 and later, enable the Access WiFi Information capability for your app in Xcode. When you enable this capability, Xcode automatically adds the Access WiFi Information entitlement to your entitlements file and App ID.
Thus, Enable Access WiFi Information for the Bundle ID in developer account. Reenable the associated provisional profiles.
In Xcode, under Targets -> Capabilities -> Access WiFi Information -> Enable it to ON.

NotificationHub Push Notification returns : The Token obtained from the Token Provider is wrong

I have Wp8.1 Silverlight app that receives push notification (WNS) from Mobileservice (the old azure service).
I therefore wanted to update to the new service because of the new features. I have now created/upgraded a new server to use App Service - Mobile App. And tested push notification with the sample app from azure (everything works).
Going back to my app WP8.1 -> Adding the new package Microsoft.Azure.Mobile.Client through NuGet (2.0.1), there is the issue that the Microsoft.WindowsAzure.Mobile.Ext does not contain the 'GetPush' extension. It seems like it is missing it? looking to the WP8 version, it only registers to MPNS, and I need WNS. So I do not know if any other assembly could be used.
Can I add another assembly reference?
Update
The following code lets me register the device on the server, and I can see the device register correctly. where the channelUri and the installationInformation are retrieved by the client and send to the server.
Installation ins = new Installation();
ins.Platform = NotificationPlatform.Wns;
ins.PushChannel = uTagAndChan.ChannelUri;
ins.Tags = uTagAndChan.Tags;
ins.InstallationId = uTagAndChan.installationInformation;
await hubClient.CreateOrUpdateInstallationAsync(ins);
Sending a test toast-notification to the registered tags, results in the following error :
The Token obtained from the Token Provider is wrong
Searching on this issue I found Windows Store App Push Notifications via Azure Service Bus. Which the proposed solution says to register to the notification hub directly from the app, I would rather not have the app to have directly access to the hub. But is this the only way? (mind you the answer was not accepted, but I will try it all though it is not a desired solution)
Update
Registering for notifications via client (WP8.1 Silverligt), makes a registration to MPNS, which I do not want.
The snippet on the server registers a WNS, the two registrations can be seen here:
The URI retrieval is done using
var channel = await Windows.Networking.PushNotifications.PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
which in the description states it returns a WNS. This seems to infer that the registration I am doing on the server (code snippet in the top) is correct and the registration on the client is faulty.
But the registration on the image seems wrong. Shouldn't the PNS Identifier be different for the two registrations? also expiration date seems wrong ?
How to mend this since the GetPush() (which was available in the sample registered the client correctly for notifications) does not exist in the NuGet package?
Update
I read one place that deleting and recreating the NotificationHub could help. I will try this today. Even IF it works, it would be more desirable to have the solution, and to know if the registrations are done correctly?
Temporary solution:
Deltede, recreated, inserted Package SID and Secret. And it works again (strange)!
Still interested in the underlying issue!
Deleted and recreated the service, setting all the same settings made it work again.
I had same issue with my UWP. But in my case I had issue with self signed certificate.
When I set the AppxPackageSigningEnabled property to True (in .csproj) then notifications stopped working and I got "The token obtained from the Token Provider is wrong" (Test send from Azure Portal).
The certificate must have same issuer as Publisher in Identity element in .appxmanifest file.

How to detect, in AIR application, if user has denied access to camera/microphone on ios 8 permissions?

I am having an AIR application which uses camera/microphone. Need to know if the user has selected "deny access" on IOS 8 ipad, then how the app will be able to detect?
The camera or the microphone are native functions so in AIR in order to access them you need native extensions. If you have a native extension already you should have a method like isSupported that returns true or false if the user allowed access to mic or camera. If you don't have a method like above you need to add one and use native code to check that user give permission for each platform in your case for iOS.
You can definitely access the microphone without an ANE via flash.media.Microphone.
I'm guessing getMicrophone() would return null if denied:
mic = Microphone.getMicrophone();
if (mic==null) {
// No microphone found or access denied
}
And this is very old (2009) but here's an example AIR project using the microphone you could reference.

Navigating to date time settings screen from my Windows Phone Application

I want to modify the system time in windows phone if it doesn't matches my server time,
so for that i want to prompt the user to change their date time by redirecting them to date time settings screen.
this is the code which i have used for android
new Intent(Android.Provider.Settings.ActionDateSettings);
suggest me a way to do the same in Windows phone.
I don't think you'll be able to access the date and time from the settings panel thought you could access the settings page from the application.
ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask();
connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi;
connectionSettingsTask.Show();
Have a look at these: How to link to a specific system-setting in your Windows Phone app?
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj662937(v=vs.105).aspx
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394011(v=vs.105).aspx
Hope it helps!

Resources