How do I get the posts of a closed Facebook group using Facebook PHP SDK? |
You need to request the user_groups permission to access a closed group
information.
To read a Group, you need:
any valid access_token if the group is public (i.e. the group's privacy
setting is OPEN)
user_groups permission for a user's non-public groups
friends_groups permission for a user's friend's non-public groups
Groups for Apps and Games require the use of an App access_token
Source: https://developers.facebook.com/docs/reference/api/group/
|
Read closed facebook groups |
The idea of a closed group is that only specific people (at the discretion
of the current members) are allowed access to it. Your app will not be
able to access the group. If you want an app to make posts, etc that
members can see, your best bet is to make an app page that people can like
instead.
|
Facebook Session Destroyed after application closed |
The key to this solution and the cause of the problem is likely found in
the access token used. My guess is that you are currently using a short
access token.
If you would use a long term access token, see,
https://developers.facebook.com/docs/facebook-login/access-tokens/, and
store it in a persistant manner the problem would be solved. Since you are
using Android I would store it in SQLite and retrive upon application
startup/resume.
From Facebook developer site:
Expiration and Extending Tokens
Some access tokens have a finite validity period of about one to two
hours. In order to continue using these tokens after the expiry time, they
need to be extended.
Apps using the Facebook SDKs for Android and iOS, desktop apps or apps
using the server-side login flow automatically
|
Facebook App request not sending to Facebook friends through Facebook Android SDK |
Direct the request
Bundle params = new Bundle();
params.putString("message", "I just smashed " + application.getScore() +
" friends! Can you beat it?");
// 2. Optionally provide a 'to' param to direct the request at a specific
user
params.putString("to", "515768651"); // Phil
showDialogWithoutNotificationBar("apprequests", params);
Suggest friends
Bundle params = new Bundle();
params.putString("message", "I just smashed " + application.getScore() +
" friends! Can you beat it?");
String [] suggestedFriends = {
"695755709",
"685145706",
"569496010",
"286400088",
"627802916",
};
params.putString("suggestions", TextUtils.join(",", suggestedFriends));
showDialogWithoutNotificationBar("apprequests", params);
Ref : http://developers.facebook.com/docs/tutorials/a
|
data always null in onactivityresult facebook android sdk 3.0 |
Please DO NOT use SessionTracker. It's in the com.facebook.internal
package, and it's not meant for external consumption. It could change or
disappear at any time without any guarantees for backwards compatibility.
You should be able to do everything you need with just the Session class.
Secondly, it looks like you're trying to do some session management logic
inside your onActivityResult method. You should move all of those logic
into a Session.StatusCallback, and ONLY pass through the onActivityResult
to the session, something like:
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
Session.getActiveSession().onActivityResult(loginScreen.this,
requestCode, resultCode, data);
}
|
how to decode arabic json data from facebook in android? |
The values are given as HTML entities, which means that a string like this
بيان
will appear like this
بيان
when used directly in an HTML document. It's just like using to
create an extra space within a <p> block, for example.
|
How to clear the facebook user data after logout in android app |
followed this link to fix this issue
`private void onSessionStateChange(Session session, SessionState state,
Exception exception) {
if (state.isOpened()) {
userInfoTextView.setVisibility(View.VISIBLE);
} else if (state.isClosed()) {
userInfoTextView.setVisibility(View.INVISIBLE);
}
}`
,here
|
Facebook user email is not accessible in some devices of Android for Facebook sdk 3.0 |
In my opinion, you should create an object of OpenRequest as shown on this
link of Stack Overflow. It might solve your problem. :-
Set permission for getting User's email ID from Facebook Login
|
which parameters can i pass in bundle for facebook WebDialog (Facebook Android SDK 3.5) |
See https://developers.facebook.com/docs/reference/dialogs/feed/
app_id: Your app's unique identifier. Required.
redirect_uri: The URL to redirect to after a person clicks a button on the
dialog. Not required for Android SDK usage.
display: Determines how the dialog is rendered. Not required for Android
SDK usage.
from: The ID or username of the person posting the message. If this is
unspecified, it defaults to the current person. If specified, it must be
the ID of the person or of a page that the person administers.
to: The ID or username of the profile that this story will be published to.
If this is unspecified, it defaults to the value of from.
link: The link attached to this post
picture: The URL of a picture attached to this post. The picture must be at
least 200px by 200px.
|
Android Share Image from Phone Gallery to Facebook using Facebook API |
You could open a stream to the image from the URI and post it that way
using ContentResolver.
Session session = Session.getActiveSession();
Bitmap photo =
BitmapFactory.decodeStream(getContentResolver().openInputStream(uri));
Request request = Request.newUploadPhotoRequest(session, photo, new
Request.Callback());
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
|
Login to facebook does not work if facebook app is installed on emulator - Android 4.3 |
This means your key hashes are incorrectly set in your app settings.
Please see this section on getting your key hashes and setting them
correctly:
https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/#create-app
|
Fetch facebook user public data, which available without loggining througth Facebook Graph API if any exists |
This isn't possible unless you have an access token. The public graph
doesn't reflect the browser information it reflects what is given in the
documentation
https://developers.facebook.com/docs/reference/api/user/
|
facebook Post on your behalf is not working in android facebook sdk 3.0.2 |
If the user deletes the app from Facebook, the only way your app will know
is if you make a graph request, and it fails.
Here are some common strategies for handling errors -
https://developers.facebook.com/docs/reference/api/errors/
You should also have a look at the Scrumptious sample that ships with the
SDK, there's a handleError() method in SelectionFragment.java that
implements the strategies outlined in the link above.
|
Facebook Login issue when facebook app is installed in android |
You can try to use
loginButton.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
or
Session.OpenRequest openRequest = new Sesion.OpenRequest(activity);
openRequest.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
|
How to upload photo to the Facebook wall using Facebook Android 3.0? |
I have a solution from many links that I read from internet. I hope it's
useful!
private static final List<String> PERMISSIONS =
Arrays.asList("publish_actions");
private static final String PENDING_PUBLISH_KEY =
"pendingPublishReauthorization";
private boolean pendingPublishReauthorization = false;
Session.openActiveSession(YOUR_ACTIVITY, true, new
Session.StatusCallback() {
// callback when session changes state
@Override
public void call(final Session session, SessionState state,
Exception exception) {
if (session.isOpened()) {
Session session = Session.getActiveSession();
if (session != null){
// Check for publish permissions
|
django-facebook not inserting facebook data to the models |
Did you specify your AUTH_PROFILE_MODULE in your settings.py ?
Try to put:
AUTH_PROFILE_MODULE = "yourApp.User_info"
Then syncdb and create a facebook account. It should do the trick.
|
Finalizing a Cursor that has not been deactivated or closed or database not closed error |
When you are done with the cursor, you need to call Cursor.close(). Leaving
it not closed leads to memory leaks. E.g.:
Cursor cursor = null;
try {
cursor = getContentResolver().query(myUri, MY_PROJECTION, null, null,
null);
if (cursor != null && cursor.moveToFirst()) {
// moar code
}
} finally {
if (cursor != null) {
cursor.close();
}
}
|
Facebook,Android- How to get friends birthday from facebook |
You probably want to go for the Graph API as this is usually a more simple
approach.
You can check out this link to see how retrieving al ist of friends are
completed in API 3.0.
Hope this helps.
|
How to Facebook page id using Facebook sdk3.1 for Android |
To retrieve the list of the pages you can query the following end point
/me/accounts
This end point along with manage_pages permission will give you the list of
the pages the User administers and you can use the same along with the
Page's access_token provided with each to post on the corresponding pages.
|
New Facebook SDK + Android. Add Image on wall facebook |
I've never sent pictures from the phone, but from a server using an image
link. I'll put this code in case it helps you since most of the logic is
similar.
final Bundle parameters = new Bundle();
parameters.putString("name", getString(R.string.app_name));
parameters.putString("caption", "haha");
parameters.putString("link", "www.google.com");
parameters.putByteArray("picture", byteArray);//I took this one from your
code. My key is "picture" instead of "image"
Session.openActiveSession(this, true, new StatusCallback() {
@Override
public void call(Session session, SessionState state, Exception
exception) {
if (session.isOpened()) {
new FeedDialogBuilder(EndGameActivity.this, session,
parameters).build().show();
//you can try this one instead of the
|
Programmatically like a facebook fan page in Facebook android SDK |
To like a post on facebook, I use this part of code to create the request.
Request likeRequest = new Request(Session.getActiveSession(), pageid +
"/likes", null, HttpMethod.POST, new Request.Callback() {
@Override
public void onCompleted(Response response) {
}
});
Where I already logged in to Facebook, so I can just call the
Session.getActiveSession().
Then I execute the request with:
Request.executeBatchAndWait(likeRequest);
You should run this in an Asynctask, since you are not allowed to do
network stuff on your main thread.
|
Get closed canvas shape in android |
Try the following way.
public class MainActivity extends Activity {
private ArrayList<Path> _graphics = new ArrayList<Path>();
private Paint mPaint;
float x1, x2, y1, y2;
boolean isDraw;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new DrawingPanel(this));
System.out.println(x1 + " " + x2 + " " + y1 + " " + y2);
mPaint = new Paint();
mPaint.setDither(true);
mPaint.setColor(0xFFFFFF00);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(3);
}
class DrawingPanel extends SurfaceView implements
SurfaceHolder.Callback
|
How to check whether an application is being closed in android |
From the Android Developer Guide:
There are a few scenarios in which your activity is destroyed due to
normal app behavior, such as when the user presses the Back button or
your activity signals its own destruction by calling finish(). The
system may also destroy your activity if it's currently stopped and
hasn't been used in a long time or the foreground activity requires
more resources so the system must shut down background processes to
recover memory.
When you switch between apps by pressing the home button, Android pauses
the activity and resumes it when you return to the activity.
For the most part, the OS decides when to quit an application so it
wouldn't make sense for you to log when an activity is destroyed. I would
suggest overriding the onPause() or the onSto
|
How to save data when a program is closed |
I typically create XML files to store parameter fields that require saving.
http://www.dotnetperls.com/xmlwriter
It works well enough when you've not got sensitive material and you need to
get parameters back without much heavy parsing.
|
Android BOOT_COMPLETED not received when application is closed |
was struggling with the same problem, the reason is you are using Log.d to
track you application in logcat, unfortunately when you restart your phone
the application is receiving the BOOT_Complete but you can't see it because
it's not logging to logcat.
try making a Toast with some text instead of Log.d to make sure if
BOOT_COMPLETED is or is not received.
hope this Help.
|
Dialog gets closed on screen rotation android |
This is because your activity is recreated on orientation change. See:
Activity Life-cycle Management [developer.android.com].
UPDATE:
The dialog for the list preference is a part of the preference hierarchy
and is created by android. Hence it is saved and restored by android in the
PreferenceActivity's onSaveInstanceState() and onRestoreInstanceState()
calls. Whereas you are creating the dialog for your Preference "prefAlert"
and must save and restore in your class' onSaveInstanceState and
onRestoreInstanceState methods. See this: Recreating an activity
[developer.android.com]
|
Connection closed before request completed - Android ION |
If you don't mind checking, I think the underlying cause of this bug was
fixed recently:
https://github.com/koush/ion/issues/18
https://github.com/koush/AndroidAsync/issues/55
Was related to SSL.
|
Application gets closed when terminal is closed, how to stop this? |
Use nohup to prevent child processes from being killed when the terminal
closes.
spawn nohup /usr/bin/firefox https://www.google.com/
I assume there's more to the script, since there's no need to use Expect
just to start firefox.
|
Select Data From Closed Excel Sheet Using ADO |
You should use Excel 12.0 for .xlsx files. Example:
Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=c:myFoldermyExcel2007file.xlsx;
Extended Properties="Excel 12.0 Xml;HDR=YES";
from connectionstrings
|
HttpClient Connection closed in between while data is transferring |
finally solved the issue, setting the following header worked for me.
method.setRequestHeader("Accept-Encoding", "gzip, deflate");
and
postResponse = IOUtils.toString(new
GZIPInputStream(method.getResponseBodyAsStream()));
|
retrieve excel data from closed workbook with ado |
When you attempt to CopyFromRecordset you are already at the end-of-file
(EOF) so there is no data to copy. Move the CopyFromRecordset statement
earlier in your code, before looping through it.
And the argument for this method is a RecordSet object:
.CopyFromRecordset objrecordset
|
Android Twitter default share-force closed |
This is what I do to share stuff with twitter:
tweetButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
initShareIntentTwi("twi");
}
});
private void initShareIntentTwi(String type) {
boolean found = false;
Intent share = new Intent(android.content.Intent.ACTION_SEND);
share.setType("text/plain");
// gets the list of intents that can be loaded.
List<ResolveInfo> resInfo =
getPackageManager().queryIntentActivities(
share, 0);
if (!resInfo.isEmpty()) {
for (ResolveInfo info : resInfo) {
if (info.activityInfo.packageName.toLowerCase().contains(type)
|| info.activityInfo.nam
|
Android : Does a Service gets killed when an Activity in the same process is closed? |
Services in Android run as long as it is not closed by OURselves or the
SYSTEM
Or by the user.
Does the running service get closed if all the activities in my app are
closed ?
If you used startService() to start the service, no. If you used
bindService() and called unbindService() a matching number of times, then
yes.
And i also came to know that both an Activity and a Service can't be run
at the same time on the main process, Is this true ?
An Activity is an object. A Service is an object. Objects do not "run" in
Java (or any other OO language that I can think of). Methods run.
For my scenario which design is best ? Activity+Service in same process,
Activity+ IntentService in same process, Activity, Service in diff
processes ?
"Activity+Service in same process".
|
Android google map v2 is not working after the application is closed and reopened |
I think that the best place would be to create a class that extends
SupportMapFragment, and initialise the map in:
@Override
public void onAttach(Activity activity)
Besides that though, I think if you initialise the map in onResume of the
container activity it should be ok. But if you by initialising you mean
adding the mapfragment to the activity, I would suggest doing it in the xml
or in your activity's onCreate. Just my two pennies.
|
Share via facebook/twitter application in android , don't open browser if facebook/twitter is installed on the device |
To post something using Facebook than integrate Facebook android sdk
Getting Started with the Facebook SDK for Android
Use Feed Dialog to post on Facebook. It automatically open fb app if it is
installed otherwise open in browser
Post to wall
public class PhotoViewer extends Activity implements StatusCallback{
Button btnShare;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_photo_viewer);
btnShare = (Button) findViewById(R.id.btnShare);
btnShare.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Session.openActiveSession(PhotoViewer.this, true,
PhotoViewer.this);
}
|
Can't publish on Facebook using Facebook SDK for Android |
Facebook Login only works for single activity of your application. You need
mention the activity name and package name while your creating facebook
appid. So Finally Facebook authentication and posting only works for
specified activity.
|
Facebook SDK 3 for Android - Login using facebook app |
it's not recommended to use only web
but if it's really needed:
LoginButton authButton = (LoginButton) view.findViewById(R.id.authButton);
//other code ...
authButton.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
|
Android Facebook check in with new 3.0 Facebook SDK |
You should use the static methods of the Request class to create requests
and execute them.
Looks like the most suitable method would be newStatusUpdateRequest that
takes a GraphPlace as a parameter.
Alternatively, you can use the newPostRequest which allows you to construct
a request that is much more similar to the way it was in previous SDK.
|
how to clean the data when the popup window is closed in jquery |
You can do $('#popup_box').empty(); to empty the div. if you want to do it
after fade animation is over then:
$('#popup_box').fadeOut("slow", function(){
$(this).empty();
});
|
GUI Save Feature so that when the GUI is closed, when it reopens it has the same data visible |
You'll want to attach a WindowListener to the FutureValueFrame and monitor
for the windowClosing event.
When this occurs, you will want to write the settings you want to keep.
When the application is loaded, you would simply read these settings in and
apply them to your application
Check out How to write Window Listeners for more details
As for the actual storage, you have a number of options...
You could use the Properties API which has save and load functionality, but
is based on a simple key/value pair API.
You could also use the Preferences API, which has a little more
functionality (store primitives), but you lose control over where the data
is stored (more or less)
The choice will come down to what it is you want to achieve and the amount
of work you want to go to
|