×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Dec 2013
    Posts
    2

    Exclamation Sending Data through NFC

    Hello Everyone,

    While this may seem very obvious, I am unable to implement the proximity APIs for Windows Phone. I have searched the whole internet, from MSDN Sample Codes to github repos, but nowhere a simple approach to sharing data has been prescribed. Either there are samples to show how to exchange messages(string types) or there are types using peer-to-peer, data saving in NFC tags etc., I tried to follow the Nokia Lumia App Lab for the same, but didn't manage to follow it. I just want a simple and straightforward approach to send a picture/video/song from one WP8 device to anothr i.e, on clicking/tapping icon in the Application Bar, the device becomes ready to share the code.

    It would be very nice if you share the code for the same. At least summarise the steps involved. Any help is deeply appreciated.


    Regards.
    Abhishek

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    527

    Re: Sending Data through NFC

    To my knowledge you basically only have the two approaches available right now when using your own code to access NFC:

    1.) App - to - App
    2.) Tag-Write/Read

    At least for Images you can however use the systems OBEX Bluetooth implementation by using a ShareMediaTask. The ShareMediaTask is not specialized on NFC/Bluetooth but rather allows your App to provide an Image (and unfortunately for now ONLY Images) and allow the User to select a way to share it. If your phone supports NFC (and it's activated in the settings) Tap&Share will be one of the options.

  3. #3
    Registered User
    Join Date
    Dec 2013
    Posts
    2

    Question Re: Sending Data through NFC

    Quote Originally Posted by SB Dev View Post
    To my knowledge you basically only have the two approaches available right now when using your own code to access NFC:

    1.) App - to - App
    2.) Tag-Write/Read

    At least for Images you can however use the systems OBEX Bluetooth implementation by using a ShareMediaTask. The ShareMediaTask is not specialized on NFC/Bluetooth but rather allows your App to provide an Image (and unfortunately for now ONLY Images) and allow the User to select a way to share it. If your phone supports NFC (and it's activated in the settings) Tap&Share will be one of the options.
    Thanks for the quick response. I tried the SharemediaTask :


    Code:
    using Microsoft.Phone.Tasks;
    using Windows.Networking.Proximity;
    
    .
    .
    .
    
    
    
    private void appbar_button3_Click(object sender, EventArgs e)
            {
    
                ShareMediaTask shareMediaTask = new ShareMediaTask();
                shareMediaTask.FilePath = "/SteamedEggsWithMilk.wmv";
                shareMediaTask.Show();
    
            }
    The file/app compiles without any error. However, when I run the app and click the respective icon, the Page goes blank(without any option of Tap+Send) ! Please tell me where I am going wrong ... I am using the WP8 inbulit Emulator !!


    Regards
    Last edited by abhi18459; 2013-12-18 at 07:52.

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    527

    Re: Sending Data through NFC

    ShareMediaTask does only support pictures, it currently unfortunately does not support other media files (e.g. Videos, Audio).

    Another gotcha is that the files being shared need to be in the media library. So you need to add the image to the media library first, get the filename you're given when loading an image from the Media Library and us that as the FilePath you give to the ShareMediaTask.

Similar Threads

  1. sending data to pc from midlet through data cable
    By doitifucan in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2009-11-13, 17:28
  2. Replies: 7
    Last Post: 2008-07-18, 02:19
  3. Sending data via OBEX: Transferring works, but no data is stored.
    By Pijus_Magnificus in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2007-03-14, 12:14
  4. wap .. and sending data ..
    By dakoz in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-05-17, 08:21
  5. What to do while sending data ?
    By fonager in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2003-08-22, 20:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×