How to view device registrations for notification hubs
[This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation]
You can view the client devices that are registered for your notification hubs by using Server Explorer in Visual Studio. You can browse all registrations, view the tags they are registered for, delete registrations, or edit the tags. The ability to browse registrations is an important part of debugging notifications during the development phase of an app that uses mobile services. It can also be useful for a published mobile service when investigating potential problems with notifications.
What you need to know
- Visual Studio 2013 Update 3
- An Azure subscription. If you don't have an account, you can create a free trial account in just a few minutes. For details, see Azure Free Trial.
Step 1: How to view registrations for a notification hub
When you view registration, you can see which client devices are registered with your mobile service, and which tags the devices are registered for.
In Server Explorer, under Azure, expand Notification Hubs and locate the notification hub that you're interested in.
Open the shortcut menu for the hub, and choose Diagnose.
Choose the Device Registrations tab.
The tab shows information about the device registrations for the hub in a list. To see the next page of results, choose the Load more link at the bottom right of the page.
The table at the bottom shows the number of registrations on each client platform.
To sort the list, choose the column headers. The columns are as follows.
|Platform||The client platform of the registered device.|
|Type||The template name for the notifications. "Native" means there is no template. See Templates.|
|Tags||The tags that the client is registered for.|
|PNS Identifier||The platform notification service identifier for the specific device or channel. This identifier depends on the platform. For Windows, it's a Channel URI. For Apple devices, it's the device token. For Android devices, it's the GCM registration ID.|
|Registration ID||The device's registration platform-independent identifier used internally by the notification hub.|
|Expiration Date||The date and time that the registration for this device expires.|
- (Optional) If you're only interested in devices that are registered with a specific tag, enter the tag in the text box under Filter by single tag, and choose the Apply button. You can select only one tag.
Step 2: How to delete a device registration
- Choose the line for the registration you want to delete.
- Choose the delete button (the red X at the top right of the table) or use the Delete key.
Step 3: How to edit the tags for a device registration
Choose the line for the registration you want to edit. Choose the Edit button (at the top right of the table).
The Edit Tags dialog box appears with a text box that contains the current tags.
Edit the tags, using a comma separator, and choose Apply. Valid tags include ASCII alphanumeric characters, . (period), - (hyphen), _ (underscore), ~ (tilde), : (colon), @ (at sign), and # (hash). The maximum length of a tag is 120 characters.
This feature is useful during the development phase when you're testing and troubleshooting notification hubs. For a production-scale app where the number of device registrations is large, you can programmatically query and edit the device registrations. See How to: Export and modify registrations in bulk.