How to get the “argument” data from a LaunchApp NFC tag in the application. WP8

拟墨画扇 提交于 2019-12-25 05:29:19

问题


I created a LaunchApp Tag, and its working fine, launching my Testapp, but with my LaunchApp tag im giving an argument too ("TestData"). So here comes my problem, how can i easily get this argument in my windows phone application? For example i just want to give the string TestData to a textblock in my app. Is it possible somehow ? My launchapp tag is a basic windows launchApp record type.

it looks like this:

Record type: windows.com/LaunchApp

Arguments: 'testData'

Platform: WIndowsPhone

App ID: {734sd....}


回答1:


In the OnNavigatedTo function you can access NavigationContext.QueryString to get ms_nfp_launchargs value. This value will be your argument

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
            base.OnNavigatedTo(e);
            string parameter = string.Empty;
            if (NavigationContext.QueryString.TryGetValue("ms_nfp_launchargs", out parameter))
            {
                MessageBox.Show("Congratulation\nYou launch application with a NFC tag.\nParamaters : "+ parameter);
                NavigationContext.QueryString.Remove("ms_nfp_launchargs");
             }
}

edit

you can find a sample in this article



来源:https://stackoverflow.com/questions/19682476/how-to-get-the-argument-data-from-a-launchapp-nfc-tag-in-the-application-wp8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!