Connect two different apps using PeerFinder.FindAllPeersAsync();

626 views Asked by At

Working with Windows 10 Universal app.

Trying to utilise Proximity API. Using 2 Dell tablets with wifi connections. There is a couple of good examples demonstrating data transfer using Wifi Direct + Proximity API and devices running the same app. My problem is that I have the two different apps (with different Package Family Names). I've tried using PeerFinder.AlternateIdentities.Add() method without success. My code looks like this:

public async Task FindPeersAsync()
{
    PeerInformationList = null;

    if ((PeerFinder.SupportedDiscoveryTypes & PeerDiscoveryTypes.Browse) == PeerDiscoveryTypes.Browse)
    {
        if (PeerFinder.AllowWiFiDirect)
        {
            PeerFinder.AlternateIdentities.Add("Server", "app1PackageFamilyName!App");
            PeerFinder.AlternateIdentities.Add("Client", "app2PackageFamilyName!App");}");

            PeerInformationList = await PeerFinder.FindAllPeersAsync();

            DisplayStatusMessage(PeerInformationList == null
                 ? "Found no peer"
                 : $"I found {PeerInformationList.Count()} devices(s) executing this same app!");
        }
        else
        {
            DisplayStatusMessage("WIFI direct not available");
        }
    }
    else
    {
        DisplayStatusMessage("Browse not available");
    }
}

My PeerFinder.Role is set to PeerRole.Peer(by default).

Example code is taken from here: https://msdn.microsoft.com/en-us/library/windows/apps/windows.networking.proximity.peerfinder.alternateidentities.aspx

Edit: If I use the same app on both tablets I can see the other device but this is not possible if I'm running different apps on the 2 devices.

My question is - is using Wifi Direct filetransfer possible between different apps (both of them windows 10 universal) and if yes what am I missing?

Thanks in advance.

0

There are 0 answers