c# - UWP roamingdata Does not async -
i make uwp app share data between windows 10 pc , windows 10 mobile phone.next code:
public static storagefolder roamingfolder = applicationdata.current.roamingfolder; public async static task writetoroamingdataasync(string str) { storagefile savedfile = await roamingfolder.createfileasync("datafile", creationcollisionoption.replaceexisting); await fileio.writetextasync(savedfile, str); } public async static task<string> readroamingdataasync() { try { storagefile savedfile = await roamingfolder.getfileasync("datafile"); return await fileio.readtextasync(savedfile); } catch { return "-1"; } }
i changed data in pc(input string "here data"), , can read in pc.but when deployed on phone, can't read data had written on pc,it give me "-1",i waited 2 hours,the mobile app gives me "-1".
i think maybe should upload app windows store can wright effect.but need test function before upload.
here somethings should declare because found answers can't solve problem:
- i closed app on pc before open app on mobilephone.
- i used same hotmail account in pc , mobilephome.
at last ,thank help!
Comments
Post a Comment