C#-Facebook-SDK WP7, the principles of how Facebook works? -
apologies if somewhere, i'm struggling find details need wp7.
i have created application on facebook required, , retrieving access token. following code posts facebook cannot response, nor can work out how monitor response?
public bool fbupload(string accesstoken, picture pic) { try { stream s = null; s = picturesloader.loadfilefromstorage(pic.url); //sets byte array correct number of bytes byte[] imagedata = new byte[s.length]; s.read(imagedata, 0, system.convert.toint32(s.length)); facebookapp app = new facebookapp(); idictionary<string, object> parameters = new dictionary<string, object>(); parameters.add("access_token", accesstoken); parameters.add("message", "test - wp7 application [upload pic , comment on wall...]"); var mediaobject = new facebookmediaobject { filename = pic.name, contenttype = "image/jpeg" }; mediaobject.setvalue(imagedata); parameters["source"] = mediaobject; facebookasyncresult postresult; facebookasynccallback fbcb = new facebookasynccallback(); app.postasync(parameters, fbcb); return true; } catch (invalidcastexception ex) { return false; } }
the other question have, how allow users allow access based upon own facebook account. want store user's account details have set account details once, , can use phone app having sign in?
you can handle post result this:
facebookasynccallback callback = new facebookasynccallback(postresult); fbapp.postasync(parameters, args, callback); private void postresult(facebookasyncresult asyncresult) { // asyncresult here; }
regarding second question, must ask permissions access data. in facebookoauthclient.getloginurl(<appid>, null, <permissions>)
method call.
once that's done, can store files have permissions locally in app.
Comments
Post a Comment