locked
Build Tablet / Install App Package / Unique Callback RRS feed

  • Question

  • Two part question:

    1)  After I build my app in release mode and create the package to install from the store menu, how do I install that package on my Samsung Build Tablet?

    2)  What do I need to do so that the callback created from a tablet is unique to that tablet? 


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Sunday, July 22, 2012 6:35 PM

All replies

  • question 1's answer is to run the powershell script on the build tablet (ps1)

    I still need the answer to question 2.


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Monday, July 23, 2012 3:35 AM
  • Hi Peter,

    I do not understand what you are asking for in question 2.  Can you give an example?

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 24, 2012 2:12 PM
    Moderator
  • in my manifest for the metro project I have set the properties based on this article:

    http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2012/06/08/windows-8-metro-style-app-simple-wns-push-notification.aspx

    I'm finding that when  I run this app in my local simulator, or when I run it deployed on my build samsung tablet, I get the identical call back url created.  It seems that somehow, my devices (whether simulator or other) needs to uniquely identify itself to the notification server, otherwise, like is happening now all my deployments will return the identical url for pushing notifications to.

    doe that make sense?


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Tuesday, July 24, 2012 2:19 PM
  • Hi Peter,

    Windows manages the push notifications.  When the user starts your application your application registers for the callback, you do not register a unique callback yourself.  You cannot register for the notification when you install.

    To try this yourself, you can run the push notifications sample.  This blog shows how to set up a test server to handle the push notification mechanism:

    http://blogs.msdn.com/b/jpsanders/archive/2011/12/02/walkthrough-creating-an-iis-server-to-use-with-wns-push-notifications-metro.aspx

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 24, 2012 2:25 PM
    Moderator
  • I did see your article, however instead of writing my own push server, I'm interested in understanding and using the technique that uses the exisiting Microsoft live server as demonstrated in the samples project "Push and periodic notifications client-side sample".  In that sample they have a fully built javascript class called SampleNotifications.  In that class (pasted below) there is a method openChannelAndUploadAsync which I believe is meant to generate a unique callback uri for the particular device, basically with the lines:

    channelOperation = Windows.Networking.PushNotifications.PushNotificationChannelManager.createPushNotificationChannelForApplicationAsync();

    and 

      channelOperation.done(function (newChannel) {
                            progress("New channel has been opened: " + newChannel.uri);

    This is working for me, however on every device I use it on, it generates the same newChannel.uri and not a unique one per devices.  I'm guessing it has something to do with credentials or the live server and that is what I'm not understanding because obviously there needs to be a unique uri for every device or all notifications would go to all devices.

    Clear?

    (BTW, please let me mark my items as answered.  that will save us both the time of marking and unmarking answers and will help others in knowing which answer is correct for the intent of the question)

               openChannelAndUploadAsync: function (url, inputItemId, isPrimaryTile) {
                    var itemId;
                    if (!inputItemId) {
                        isPrimaryTile = true;
                        itemId = mainAppTileKey;
                    } else {
                        itemId = inputItemId;
                    }
    
                    var that = this;
                    return new WinJS.Promise(function (completed, failed, progress) {
                        // The progress handler is meant for communicating back with the UI
                        // Your code likely will not need such verbose progress updates
                        progress("Opening a channel");
                        var channelOperation;
                        if (isPrimaryTile) {
                            if (inputItemId) {
                                // Primary tile for another application in the package
                                channelOperation = Windows.Networking.PushNotifications.PushNotificationChannelManager.createPushNotificationChannelForApplicationAsync(itemId);
                            } else {
                                // Primary tile for this application
                                channelOperation = Windows.Networking.PushNotifications.PushNotificationChannelManager.createPushNotificationChannelForApplicationAsync();
                            }
                        } else {
                            // Secondary tile
                            channelOperation = Windows.Networking.PushNotifications.PushNotificationChannelManager.createPushNotificationChannelForSecondaryTileAsync(itemId);
                        }
    
                        channelOperation.done(function (newChannel) {
                            progress("New channel has been opened: " + newChannel.uri);
    
                            var tileData = that._urls[itemId];
                            // Upload the channel URI if the client hasn't recorded sending the same uri to the server
                            // (1 == 0 forces this to do it again -PGK)
                            if (1 == 0 &&   tileData && newChannel.uri === tileData.channelUri) {
                                progress("URI already uploaded");
                                that._updateUrl(url, newChannel.uri, itemId, isPrimaryTile);
                                completed(newChannel);
                            } else {
                                WinJS.xhr({
                                    type: "POST",
                                    url: url,
                                    headers: { "Content-Type": "application/x-www-form-urlencoded" },
                                    data: "channelUri=" + encodeURIComponent(newChannel.uri) + "&itemId=" + encodeURIComponent(itemId)
                                }).done(function (request) {
    
                                    // Only update the data on the client if uploading the channel URI succeeds.
                                    // If it fails, you may considered setting another background task, trying again, etc.
                                    // OpenChannelAndUploadAsync will throw an exception if upload fails
                                    progress("Uploaded to server. Response: " + request.response);
                                    that._updateUrl(url, newChannel.uri, itemId, isPrimaryTile);
                                    completed(newChannel);
                                }, failed);
                            }
                        }, failed);
                    });


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Tuesday, July 24, 2012 2:42 PM
  • Peter,

    I did not mark it answered.  I proposed it as an answer.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 24, 2012 2:59 PM
    Moderator
  • Does propose as answer automatically disappear if it does not become marked as answer?  if that is what happens then I will ignore the proposed as answers.  

    It seems like in the world of Windows 8 metro javascript programming, you are the only helper.  You are doing a lion's job by yourself and I do appreciate it.  Unfortunately, there seems to be no other place to turn for issues which in general I feel are overly complex for forums.  i don't mean to be short with you, it is just that the lack of thorough documentation, the lack of Microsoft real support for a product that is meant to be in full production in 2 months frustrates me to know end.


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Tuesday, July 24, 2012 3:06 PM
  • Hi Peter,

    No worries!  You can of course create a support case however the free support of forums is very attractive!

    Proposed simply means we think the answer given addresses the issue, nothing more.  It isn't answered until it is answered!

    We do our best to ensure we answer all forum questions so hang in there... Some take more research but we aim to get back to all of you.

    We do out best to keep up with the number of questions in the forums and do rely on other community members to pitch in as well.  I appreciate your participation.  Documentation is continually being updated but there is a lot to document since this is a new SDK area.

    I am still drilling into your above questions...

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 24, 2012 3:11 PM
    Moderator
  • Peter,

    It does indeed generate a unique id when you reopen the channel (scenario 1).  It is a long URI so make sure you are not cutting it off where ever you are displaying it!

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 24, 2012 6:48 PM
    Moderator
  • That’s very strange. Are you using a real store id or just the windows live service like in the article I mention above? ( http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2012/06/08/windows-8-metro-style-app-simple-wns-push-notification.aspx )

    I know I'm not cutting it off because I successfully call it to get my notifications, just the same one for multiple devices.


    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Tuesday, July 24, 2012 6:51 PM
  • I am using the temporary service outlined here:

    http://blogs.msdn.com/b/jpsanders/archive/2011/12/02/walkthrough-creating-an-iis-server-to-use-with-wns-push-notifications-metro.aspx

    Perhaps it is a problem with your code?  Would you like to send me a simple repro?  I am using the push notification sample.

    -Jeff


    Jeff Sanders (MSFT)

    Tuesday, July 24, 2012 7:12 PM
    Moderator
  • I can send you my vs project, it's pretty simple.  can you send me a private not with where to send the zip.  (post the email to peterkellner.net/contact) or let me know another way to send it.

    Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider

    Tuesday, July 24, 2012 7:23 PM
  • To followup:

    The call back was the same because you were using the same machine (emulator and physical machine).  Then emulator is simply a desktop session of your current machine.

    Different devices will return different URIs.

    -Jeff


    Jeff Sanders (MSFT)

    Wednesday, July 25, 2012 6:09 PM
    Moderator