OceanLabs / FacebookPhotoPicker-Android

An Android photo picker that allows users to log in a select photos from Facebook. https://www.kite.ly
MIT License
6 stars 3 forks source link

How to Install and usage? #5

Open cyanlabsid opened 8 years ago

cyanlabsid commented 8 years ago

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

norman-kapschefsky commented 8 years ago

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:

compile 'ly.kite:facebook-photo-picker:1.2.0'
<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"/>
Intent intent = new Intent(activity, FacebookPhotoPickerActivity.class);
activity.startActivityForResult(intent, MY_REQUEST_CODE);
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 commented 8 years ago

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 commented 8 years ago

@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 commented 8 years ago

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 commented 8 years ago

@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 commented 7 years ago

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 commented 6 years ago

@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?