简体   繁体   English

是否有用于为Windows Phone 7应用程序生成Microsoft标记的URL?

[英]Is there a URL for generating Microsoft Tags for Windows Phone 7 Apps?

I'm developing a web site that will feature windows phone 7 apps, and I'd like to include a Microsoft Tag so users can point their phone at the screen and download the app that is featured. 我正在开发一个将配备Windows Phone 7应用程序的网站,我想要包含一个Microsoft Tag,以便用户可以将他们的手机指向屏幕并下载特色应用程序。

So far their website has proven to be quite unhelpful, and it seems you need to sign up for the API if you don't want to generate them all manually. 到目前为止,他们的网站已被证明是非常无益的,如果您不想手动生成它们,您似乎需要注册API。

I was wondering if there is a single URL that I can place the app ID into, hosted on Microsoft's servers, that will generate the tag for me? 我想知道是否有一个网址,我可以将应用程序ID放在微软服务器上托管,这将为我生成标签?

There isn't just one URL that will create a tag for you. 不只有一个URL会为您创建标记。 But this being Stack Overflow, here's a short program that uses the Tag API to create any number of tags. 但这是Stack Overflow,这是一个使用Tag API创建任意数量标签的简短程序。 For the program to work, you will need to: 要使程序正常工作,您需要:

  1. add a service reference to the Tag API at https://ws.tag.microsoft.com/MIBPService.wsdl 通过https://ws.tag.microsoft.com/MIBPService.wsdl向Tag API添加服务引用
  2. Make sure to insert your own Tag API key into creds.AccessToken . 确保将自己的Tag API密钥插入creds.AccessToken
  3. Increase the maxArrayLength="16384" value in app.config to something higher. app.config中maxArrayLength =“16384”值增加到更高的值。 This is needed to pull the ~45KB tag images from the web service. 这需要从Web服务中提取~45KB标记图像。 I used 100000. 我用了100000。

The complete blog post is at http://flyingpies.wordpress.com/2011/05/25/creating-several-microsoft-tags/ . 完整的博客文章位于http://flyingpies.wordpress.com/2011/05/25/creating-several-microsoft-tags/

using System;
using System.IO;
using MakeTags.Tag;

namespace MakeTags {
    class Program {
        static void Main(string[] args) {
            MIBPContractClient tagService = new MIBPContractClient();
            UserCredential creds = new UserCredential();
            creds.AccessToken = "your-access-token-here";

            int tagsToCreate = 10;
            string category = "Main";
            string tagTitlePrefix = "My Sample Tag ";
            string tagImageFilePathFormat = "mytag{0}.png";

            for (int i = 0; i < tagsToCreate; ++i) {
                Console.WriteLine("Creating tag " + i);

                string tagTitle = tagTitlePrefix + i;

                URITag tag = new URITag();
                tag.Title = tagTitle;
                tag.MedFiUrl = "http://flyingpies.wordpress.com/2011/05/24/creating-several-microsoft-tags";
                tag.UTCStartDate = DateTime.UtcNow;
                tagService.CreateTag(creds, category, tag);

                string tagImageFilePath = string.Format(tagImageFilePathFormat, i);
                byte[] tagImageBytes = tagService.GetBarcode(
                    creds,
                    category,
                    tagTitle,
                    ImageTypes.png,
                    1f,
                    DecorationType.HCCBRP_DECORATION_DOWNLOAD,
                    false);
                File.WriteAllBytes(tagImageFilePath, tagImageBytes);
            }
        }
    }
}

If you just need a tag that redirects the phone browser to the app download site, I would suggest you just create a Microsoft Tag account and create the tag as a "one off": Hardcode the url in the tag manager and download the generated tag image. 如果您只需要一个将手机浏览器重定向到应用程序下载站点的标签,我建议您只创建一个Microsoft Tag帐户并将标签创建为“一次性”:在标签管理器中对该URL进行硬编码并下载生成的标签图片。 After that you just have to use that image on your website or print advertizement - you don't have to worry about the Tag API or even return to the Tag Manager (as long as your download url stays the same). 之后,您只需在您的网站上使用该图像或打印广告 - 您不必担心Tag API甚至返回到Tag Manager(只要您的下载URL保持不变)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM