Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Install and usage? #5

Open
cyanlabsid opened this issue Jun 7, 2016 · 7 comments
Open

How to Install and usage? #5

cyanlabsid opened this issue Jun 7, 2016 · 7 comments

Comments

@cyanlabsid
Copy link

Can you show me the Installation and the usage to use this library?

@norman-kapschefsky
Copy link

norman-kapschefsky commented Jun 8, 2016

Hi @cyanlabsid,
I also tried to use this library - and I made it, but without any documention it was pain in the .....s . Did the following to make it work:

  • Add to build.gradle (found version in maven central repo)
compile 'ly.kite:facebook-photo-picker:1.2.0'
  • Got manifest merge conflicts because I already integrated facebook sdk, used tools:replace in
<meta-data android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/fb_app_id"
            tools:replace="android:value" />
<activity android:name="com.facebook.FacebookActivity"
          ...
            android:label="@string/app_name"
            tools:replace="android:label"/>
  • started picking with
Intent intent = new Intent(activity, FacebookPhotoPickerActivity.class);
activity.startActivityForResult(intent, MY_REQUEST_CODE);
  • get result via onActivityResult(int requestCode, int resultCode, Intent data) of Activity that you have used to start the intent
if (requestCode == MY_REQUEST_CODE) {
    if (resultCode== Activity.RESULT_OK) {
        Photo[] photos = FacebookPhotoPicker.getResultPhotos(data);
        for (Photo photo : photos) {
            URL url = photo.getFullURL());
            // do something with it
        }
    }
}

Hope this helps you and the others.

What's realy stupid in my mind is that you can trigger the photo picker staticly via Fragment, even it is only used to get the activity from ... o.O

FacebookPhotoPicker.startPhotoPickerForResult(Fragment fragment, int activityRequestCode);

In additon you would have to know that the result is passed to fragment.getActivity().

The Facebook picker is working pretty similar to the Instagram one, that I have implemented before. There is a little documentation for it so it helped me to make this work.

@cyanlabsid
Copy link
Author

Thank you it's working pretty well for me, but what the min sdk this library need? why in Kitkat OS it doesn't work? There is the error log
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/facebook/R$attr.class

but work in Lollipop OS
Thanks before ^^

@norman-kapschefsky
Copy link

norman-kapschefsky commented Jul 20, 2016

@cyanlabsid
Look in build.gradle where minSDK version 15 is declared. It's not my project but I'm pretty sure it is 15 because of the Facebook SDK (4.6+ needs it I guess). So your app needs 15 as well to use this library. In addition it seams that you have added the facebook sdk somewhere else as a dependency. In that case try to exclude it like this:

compile('ly.kite:facebook-photo-picker:1.2.0') {
    exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
}

Ensure that your own facebook dependency has the same version like the photo picker (currently 4.7.0) or if functionality hasn't changed it can be higher.

Hope this helps you.

@cyanlabsid
Copy link
Author

Thank you @norman-kapschefsky for your help, but it's still get the same error. do you have any recomendation for another library to image picker facebook? ^^

@norman-kapschefsky
Copy link

norman-kapschefsky commented Jul 21, 2016

@cyanlabsid
I don't know other similar libraries. Concerning your error, there must be another library or even your project where facebook is added as a dependency more than once. You have to locate it and exclude it as mentioned above. One tip I got somewhere from Stackoverflow press within Android Studio CTRL+ SHIFT + ALT + N at the same time and enter (in your case) facebook. You will see it's usage and the packages that are referencing it. With that you have a chance to find out where a library is also added to.

@AmilaWijayarathna
Copy link

Hi, I'm using this library to pick images to android app from facebook. But After the login nothing show in the display. can anyone guide me how to do this properly? thanks

@JunWeiAndroid
Copy link

@norman-kapschefsky hi, I use this libary as your usage, but i got an error ( Manifest merger failed with multiple errors) when building.How to reslove this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants