i am currently building a game with Unity for Android.
I want to use the AppRequest feature from the Facebook API.
User should be able to challenge their friends.
I implemented it just like in the tutorial (https://developers.facebook.com/docs/unity/reference/current/FB.Apprequest)
FB.AppRequest(
message:"message",
title:"title",
callback: appRequestCallback);
I have the following permissions:
basic_info
publish_actions (to post the score)
friends_games_activity (to see the scores of the friends)
And yes, I am logged in. I check that directly before that.
I tested it with development mode on and off.
If I run the game on Android and click the button that calls the method, Facebook tries to load something, but it will never appear. I see the load-icon (this turning circle thing) but nothing appears and I am back in my game. It looks like everything is directly cancelled.
If I run the game in the Unity Editor everyhing works just fine. I can see my friends and send them requets.
What am I missing? It's driving me crazy.
Do I need another permission?
Everything else works perfectly with the FB SDK.
I have encountered a similar problem with Facebook Unity SDK, which was solved by passing more parameters - these marked as optional too.
It shouldn't work like that, but they're still working on that plugin, so maybe you could give it a try, and specify all parameters you can, or manually pass them default values.
I found the solution.
I passed to many characters in the message and title strings.
Therefore my question was maybe misleading, because I replaced the strings with short dummy values.
If you encouter a similar issue:
The length of message should be at most 60 characters.
The length of title should be at most 50 characters.
I tried it on another phone got an error message there. On my phone the dialog just did not appear.
Related
We are developing an app that should get data from the Moves app API.
When authorising our app on the mobile phone, we manage to do so successfully in the case in which we submit the PIN provided by the desktop link into the moves app:
https://api.moves-app.com/oauth/v1/authorize?response_type=code&client_id=<client_id>&scope=<scope>&state=<state>
In the case where I use the Mobile website / app link instead, this won't work:
moves://app/authorize?client_id=<client_id>&scope=activity%20location&state=<state>&redirect_uri=<redirect_uri>
Note: <redirect_uri>==encodeURIComponent("mymovesconnector:8081/callback").
The response we get from the Moves API is 400: {"error":"invalid_grant"}.
From the docs, it says that invalid_grant can happen if either:
the code in the request is not valid or
the code has expired (it’s valid for 5 minutes currently) or
the code has been revoked, because it was already used in an access token request (both successful and unsuccessful requests will revoke the code) or
you are missing the redirect_uri parameter when it’s required.
My checklist:
I guess this could have happened, but how/why should this code, provided over moves://, be different than the one provided through the https:// request? What control do I have over this?
not my case, since I'm using the code right away within less then a few seconds
if this might have happened, where could it happen other than through the redirect url?
I'm providing it always. It's always the same - also in the app settings on moves.
Can't figure out what I'm missing. Went through the docs many times, step by step. No success.
While writing down my question, I managed to figure out a solution to this problem.
The docs don't point out that response_type=code might also be used for the moves:// link. I tried to add this parameter, and it worked!
Note: this has been tested on a virtual android device only (Genymotion).
I'm new to Android development. I'm working on an app for use at work - I'm an EMT. I was hoping to use the state's registry as a means of authenticating the user as an active provider. https://ems.health.state.pa.us/emsreg/activepractitioners.aspx
I know nothing of asp, except that I should be able to pass some input through the URL with ?name=value. But when I inspect the element of the last name field...
input name="_ctl0:_ctl0:SessionLinkBar:Content:tbxLName" type="text"
id="_ctl0__ctl0_SessionLinkBar_Content_tbxLName"
I can't use this. Honestly not even sure what I'm looking at here. Is ":" a container?
Ultimately I'd like to take the user input on 2 edit texts (last name & certification #), click a button to POST them to the activepractitioners.aspx, and either get the whole response and pare down for what I need (Status Active, which I've yet to find labeled on the site) or verify the response then query its label.
I've tried a few of the methods here and I keep crashing the emulator. Also I'd rather not see all the strikethroughs in Android Studio from deprecated methods. I welcome all help, but please remember I'm a n00b - take it slow for me. Thanks!
UPDATE:
I've gotten some results using JSoup. I get to a landing page that should contain just one result (the certification # is unique) and a link. The format of the link is as follows:
<a id="_ctl0__ctl0_SessionLinkBar_Content_dgSearchResults__ctl2_lnk" href="javascript:__doPostBack('_ctl0$_ctl0$SessionLinkBar$Content$dgSearchResults$_ctl2$lnk','')">
It uses javascript to invoke "doPostBack." Any idea on how to automate this too? As it is I can parse the response to a document and scrape the table for the word "active." But I'd like a bit of fool-proofing. Thanks in advance!
Since you are new to Android dev, I suggest you to spend some time having a look to Google Android Volley APIs.
It allows you to easily set up GET and POST requests (and works great).
I'm following documentation as states:
https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads/#advanced
Specifically: Measure App Installs
However, I did the following code:
com.facebook.AppEventsLogger.activateApp( this, APPLICATION_ID_FACEBOOK );
However, in dashboard, it doesn't detect the install:
Any tips?
LogCat outputs the following:
FacebookException: No attribution id returned from the Facebook application
Ok. Solved.
Basically for whoever faces this:
FACEBOOK APP must be installed in device.
USER must be logged in.
Thats it.
=)
Another great but hidden hint is to enable verbose logging via
FacebookSdk.addLoggingBehavior(APP_EVENTS)
The output is actually very helpful and even contains error analysis and descriptions.
I want to make MyApp name show on the upper space as Facebook Samples shown.
But even the source code is the same with the sample's, the raw/layout data are the same, too. I don't know why MyApp shows only "You must log in first".
Is anything I missed?
Now I put my whole source code up to the share space: http://qfs.mobi/f689673
And I found it seems not login successful if I input the right information.
Finally, I found the problem..
I change to use the Facebook Sample And run with my app_id. And then I found there are error code when login dialog shows. "This app is in sandbox mode."
God! Isn't sandbox mode for "Developers"? Seems I misunderstand..
Since this a problem is with the webpage shown by the facebook sdk, it doesn't seem to be an issue with your android code, but rather with the way your facebook app is defined in the app center.
The SDK basically redirects you to this link: https://m.facebook.com/dialog/oauth?app_id=xxx&redirect_uri=fbconnect://success (replace xxx with your app_id). Try going to the link when you are not logged in or when you are in incognito mode, you should see the login screen as such: http://imgur.com/xeqigSu
You could check a couple of things:
That your app is live. Check this on your app basic settings page
Try changing the language on the login page and see if that helps, since your app is in a language other than English
go in android setting,then Applications,Manage applications,find your browser and clear data,it works as usual!
I'm very close to having what I need for my facebook dialog, the post is working successfully, which has taken me a fair amount of time as i've struggled with the facebook sdk.
When I open the dialog to post a message to the feed ( or when I call authorise in a dialog ), it shows as shown here:
http://minus.com/mg6utFaHf
I'm looking for something more like this:
Any ideas why mind is showing so... ugly?
It's very square, in a webview, with the X in the top left.
Thanks, any help is much appreciated.
The new Facebook SDK should allow you to use the built in Facebook app to do such things via intent.
In alternative you could use the Intent ACTION_SEND to achieve what you want.
The new SDK of theirs implements a way of authorizing called Single Sign-On which searches the device for the presence of the Facebook app and sends an Intent to that app which will authorize for you. If the Facebook app is not found then it will fall back to the dialog method.
You'll still be stuck with square iOS-y like design for in app sharing, invite friends, etc. The only way I can think of getting around this is to use FQL but how to do that is beyond my knowledge.
http://minus.com/mg6utFaHf is just the standard facebook Feed dialog ... see https://developers.facebook.com/docs/reference/dialogs/feed/ ... just change www. to m. as for example https://m.facebook.com/dialog/feed?app_id=123050457758183&link=https://developers.facebook.com/docs/reference/dialogs/&picture=http://fbrell.com/f8.jpg&name=Facebook%20Dialogs&caption=Reference%20Documentation&description=Using%20Dialogs%20to%20interact%20with%20users.&redirect_uri=http://www.example.com/response
Said that if you want it different you have to implement UI and post data by your own by Graph api