Comments (22)
I revised the code of Google Plus, Twitter and Facebook social networks and the Fragment is not used for nothing more than fragment.getActivity().
In the documentation of the SocialNetwork class says:
"@param fragment ant not activity or context, as we will need to call startActivityForResult,
we will want to receice on onActivityResult in out SocialNetworkManager
fragment"
But it has no sense because the Activity can pass the onActivityResult with the simple code of:
Fragment fragment = getSupportFragmentManager().findFragmentByTag(SOCIAL_TAG);
if (fragment != null) {
fragment.onActivityResult(requestCode, resultCode, data);
}
ĺike the original Android Social Network library.
If I have to use ASNE inside a Fragments destroys the amaaaazing modularization of the library :(
Anyway, I going to try this .... shitty ... ugly ... shameful patch: extends Fragment and override "getActivity" to return the activity without make a commit, only to test if its possible to use without a real fragment
from asne.
I was having issues with this issue as well. I wrote my own fix like this
protected SocialNetwork(Fragment fragment, Context context) {
mSocialNetworkManager = fragment;
mSharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
}
So I used it like so
FacebookSocialNetwork fbNetwork = new FacebookSocialNetwork(mSocialNetworkManager, ctx, fbScope);
GooglePlusSocialNetwork gpNetwork = new GooglePlusSocialNetwork(mSocialNetworkManager, ctx);
I simply pass the socialNetworkManager fragment from my activity as the fragment and the activity as context. Obviously, the relevant SocialNetworkClasses (I am only using facebook and google) were modified.
from asne.
@frostymarvelous Really nice solution!
from asne.
Thanks @tylerjroach
from asne.
@frostymarvelous can you make a pull request with the solution?
Thank you very much
from asne.
ASAP. My computer died on me this morning.
from asne.
Done. Can someone please review it for me, I couldn't make a build to test it.
from asne.
Thanks @frostymarvelous We have to wait @gorbin to accept it
from asne.
I try to use your changes to use ASNE into an Activity, but it doens't work, fragment.getActivity() is null
mSocialNetworkManager = new SocialNetworkManager();
ArrayList fbScope = new ArrayList();
fbScope.addAll(Arrays.asList("public_profile, email, user_friends"));
FacebookSocialNetwork fbNetwork = new FacebookSocialNetwork(mSocialNetworkManager, this, fbScope);
mSocialNetworkManager.addSocialNetwork(fbNetwork);
from asne.
@pierrexn did you change SocialNetwork like below as well??
protected SocialNetwork(Fragment socialMediaManager, Context context) {
//we keep the fragment in case it is needed in future. it also minimises the changes required.
mSocialNetworkManager = socialMediaManager;
mSharedPreferences = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
}
from asne.
yes, it works if i replace in FacebookSocialNetwork, fragment.getActivity() by context
from asne.
O man! I missed it
String applicationID = Utility.getMetadataApplicationId(fragment.getActivity());
should be
String applicationID = Utility.getMetadataApplicationId(context);
from asne.
@pierrexn fixed with this thedumbtechguy@9c32049
from asne.
@Aracem what about this? I need to fix this immediately, how is possible that this fix is not on the build yet?
from asne.
I think he no longer maintains this. We might need another fork.
from asne.
Yes, as @gorbin says in the Readme:
"Sorry, but I freeze work on project for some time(I hope not long, nearly month) - too busy. I saw all Issues and will resolve them as soon as I can.
I checked project - current maven libs mostly works fine. For now I need help with Issues and open for pull requests - will check them and merge on weekends."
I have more or less ready a PR with Fabric integration that could be good for others. Perhaps is time to create a Fork to continuing the work
from asne.
Let's go ahead and create the Fork. This is a critical library. When Login fails, users run!
from asne.
I just need to instantiate the Manager from Activity, not from Fragment.
from asne.
Hello, guys I'm really sorry, I'm too busy now and cant maintains ASNE, but I check and update it on vacation as soon as posible.
But if you want to pull new features or updated possibilities I check it on my free time. Or I can add somebody to repo owners to update it more quikcly.
I will maintains this repo but only when I'm really can, sorry for this
from asne.
@gorbin Make me and owner on the lib.
It needs some work and I am willing to maintain it.
from asne.
@frostymarvelous add you as collaborator, thruly there are a lot of work to do.
I am planning update gradle, all dependecies and solve issues.
right now want to update master branch, then work in dev to restore functionality, only after test merge it to master and build release for libs, then update it in central - to restore functionality
You can contact with me via email to discuss plans.
from asne.
Great. Sure thing.
from asne.
Related Issues (20)
- OkAuthActivity - Unable to find
- cannot find symbol method OnGetFriendsIdComplete
- Not getting Login success Callback from any social login HOT 1
- Email null for Facebook, twitter, linkedin HOT 4
- Requesting Detail profile of user for Facebook App crashes
- Getting a Attempt to invoke virtual method 'android.support.v4.app.FragmentManager android.support.v4.app.FragmentActivity.getSupportFragmentManager()' on a null object reference HOT 3
- While Login on LinkedIn getting this error HOT 1
- "Must be called from main thread of process" Error in OkAuthActivity.java
- Not requested Vk email. Field always is null.
- Error:Configuration with name 'default' not found.
- Confustion about setup
- Incompatible types SocialNetworkManager
- get twitter follower counts
- Error:Error converting bytecode to dex HOT 1
- Security warning HOT 5
- Dead project
- DialogFragment instead of Fragment HOT 1
- Error: Can't get personStatus{statusCode=NETWORK_ERROR,resolution=null})
- "java.lang.IncompatibleClassChangeError" If I include GooglePlus dependency
- For LinkedIn its not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asne.