locked
Problem with use app roaming between different computers

    Frage

  • Hi, 

    Please help me implementing app roaming to my application. I have great trouble make it work. 

    How do I communication the same set of data from the same app for different computers? Am I suppose signing into Live account or other registration for the application I developed? 

    and here is code I wrote, 

    for transmitter part, 

    public ApplicationData AppData = ApplicationData.Current;

    public ApplicationDataContainer roamingData = ApplicationData.Current.RoamingSettings;

    public main()

    {

    roamingData.Values["hello"] = "Hello? anyone there?";

    AppData.SignalDataChanged();

    }

    For receiver part, 

    public ApplicationDataContainer roamingData = ApplicationData.Current.RoamingSettings;

    public main()

    { ApplicationData.Current.DataChanged += new TypedEventHandler<ApplicationData, object>(DataChangeHandler);

    }

    void DataChangeHandler(ApplicationData appData, object o)
    {
                if (roamingData.Values.ContainsKey("hello"))
                {
                    Debug.WriteLine("!!!! App Roaming: {0}", roamingData.Values["hello"].ToString());
                }

    }

    Thanks in advance!

    Jerry

    Dienstag, 10. April 2012 11:04

Antworten

  • The user needs to log into both systems with the same Microsoft ID for the data to roam. The application doesn't need to do anything special. What is stored in the RoamingSettings on one computer should automatically roam to others.

    Note that this isn't necessarily immediate but may take some time. Check the data when you start up and then register for DataChanged in case it updates after the app has launched. This isn't really a transmitter/ receiver part, but more of a synced storage: all copies of the app are inherently equal and talk to what is logically the same roaming store. If you need a real communication system then you'll want to look into the various networking functions.

    See Roaming application data, Quickstart: Local application data (C#/VB/C++), and the Application data sample.

    --Rob

    Mittwoch, 11. April 2012 00:08

Alle Antworten

  • The user needs to log into both systems with the same Microsoft ID for the data to roam. The application doesn't need to do anything special. What is stored in the RoamingSettings on one computer should automatically roam to others.

    Note that this isn't necessarily immediate but may take some time. Check the data when you start up and then register for DataChanged in case it updates after the app has launched. This isn't really a transmitter/ receiver part, but more of a synced storage: all copies of the app are inherently equal and talk to what is logically the same roaming store. If you need a real communication system then you'll want to look into the various networking functions.

    See Roaming application data, Quickstart: Local application data (C#/VB/C++), and the Application data sample.

    --Rob

    Mittwoch, 11. April 2012 00:08
  • thanks! it works now,

    but how do I know how often/when it updates the settings to cloud and update the settings on another local device?

    I tested 2 devices by updating a message with timer for every 5 sec by one device, and seems like second device update the message every 12 sec. Is that always the case? 

    another question is that I get the quota from the server,

    Max App Roaming Quota: 100
    Current Used App Roaming Quota: 0

    Is the number are in terms of MB? and is that always the same for all Microsoft users?

    Thanks again,

    Jerry

    Mittwoch, 11. April 2012 08:22
  • Hi Jerry,

    You can't know for sure how often or when it will update the settings. See the comments in the Guidelines for roaming application data

    Don't use roaming for instant syncing

    Windows roams app data opportunistically and doesn't guarantee an instant sync. In scenarios where a user is offline or on a high latency network, roaming can be delayed significantly. Don't build a UI that needs that sync to occur instantly. For example, don't create media apps that push up-to-the-second updates on a user’s position in a song that rely on roaming application data.

    The quota returned from ApplicationData.RoamingStorageQuota is documented as being in KB. Roaming storage should be used for lightweight settings, not major data stores. Again, see the guidelines I linked.

    --Rob

    Donnerstag, 12. April 2012 17:04