I’m trying to integrate Facebook into my Android Java app, what I want it to do is post status updates silently from a service. My app allows the user to login and define the criteria for these updates then the service periodically adds status updates.
The issue I’m having is that the posts aren’t silent. They bring up the application, I’ve tried adding flags such as FLAG_ACTIVITY_NO_USER_ACTION and FLAG_ACTIVITY_NEW_TASK plus others to the activity that starts to post the update but these have no effect.
I’ve also tried having the post done without an activity but this failed as the Facebook SDK requires an activity to call the authorize, which is needed when the session expires.
Is there anyway to do this? Has anyone else had similar problems?
To post to a user feed (what I assume you mean by “post status updates”) you need the user to grant you the publish_stream permission (http://developers.facebook.com/docs/reference/api/permissions/) and then you need to get a valid access token, once you have that, you can post the status updates via normal http POST request.
For the status update it states here: http://developers.facebook.com/docs/reference/api/user/#statuses the url of the request and the parameters.
The thing is that the android facebook sdk does just that for you, and since you want to do it “silently” you’ll need to do it in another thread, the sdk does that too, so it’s faster and better do use it.
It’s true, the sdk also comes with it’s own activities and dialogs, but you don’t have to use that, you can just use it for the requests.
The sdk provides you two ways to do so:
The only thing you must use a facebook UI is the authentication process, you can use the sdk for that or open a web view