Pinterest api for fetching pins for a user - android

I'm trying to integrate Pinterest into an android application and I would like to retrieve all the pins for a specific user (obviously after the user has logged in). Is this possible to be achieved by utilising the api released by Pinterest? Many thanks.

Yes, this is possible, check Pinterest sample app on GitHub:
link
sample code:
private void fetchPins() {
adapter.setPinList(null);
adapter.notifyDataSetChanged();
PDKClient.getInstance().getMyPins(PIN_FIELDS, new PDKCallback() {
#Override
public void onSuccess(PDKResponse response) {
List<PDKPin> list=new Arraylist<>;
//getting pin list
list=response.getPinList();
}
#Override
public void onFailure(PDKException exception) {
_loading = false;
Log.e(getClass().getName(), exception.getDetailMessage());
}
}
);
}
Happy coding!

Related

How to validate multiple purchase transactions with Android AppsFlyer SDK

I am having an issue with AppsFlyer Android SDK AppsFlyerInAppPurchaseValidatorListener class.
AppsFlyerLib.getInstance().registerValidatorListener(this,new
AppsFlyerInAppPurchaseValidatorListener() {
public void onValidateInApp() {
Log.d(TAG, "Purchase validated successfully");
}
public void onValidateInAppFailure(String error) {
Log.d(TAG, "onValidateInAppFailure called: " + error);
}
});
Currently there is no way to detect which particular purchase transaction was successful with this listener. So for example, if I am validating multiple purchase transactions from a Google Billing Client queryPurchasesAsync call. This listener will not tell me which specific purchase transaction was successful or failed.
The closest solution to this that I found was at:
AppsFlyerAndroidWrapper.java
public static void validateAndTrackInAppPurchase (String publicKey, String signature, String purchaseData, String price, String currency, HashMap<String, String> additionalParameters, String objectName)
{
AppsFlyerLib.getInstance().validateAndLogInAppPurchase(UnityPlayer.currentActivity,
publicKey, signature, purchaseData, price, currency, additionalParameters);
if (objectName != null)
{
initInAppPurchaseValidatorListener(objectName);
}
}
public static void initInAppPurchaseValidatorListener(final String objectName)
{
AppsFlyerLib.getInstance().registerValidatorListener(UnityPlayer.currentActivity, new
AppsFlyerInAppPurchaseValidatorListener()
{
#Override
public void onValidateInApp() {
if(objectName != null){
UnityPlayer.UnitySendMessage(objectName, VALIDATE_CALLBACK, "Validate
success");
}
}
#Override
public void onValidateInAppFailure(String error) {
if(objectName != null){
UnityPlayer.UnitySendMessage(objectName, VALIDATE_ERROR_CALLBACK, error);
}
}
});
}
Here it looks like they instantiate a new validator listener for each call to validateAndLogInAppPurchase. However, will that not just get rid of the previous validator listener that was instantiated? To me it looks like you can only register ONE validator listener at a time with AppsFlyer. There is no way to tie a particular validator listener to a specific validateAndLogInAppPurchase call. I've searched high and low and have not been able to find a definitive answer to this question so any pointers anyone has would be greatly appreciated.
Thanks
I have searched through github, the Appsflyer Android SDK samples and this particular situation is never addressed. In particular there are no Android SDK samples that tackle this issue so it may be that support for multiple transaction validations is not supported by the Appsflyer Android SDK.

Implementation of Android Fingerprint technology

I'm not sure if this is the right place to ask for flow-related question. Do guide me if you're aware of a better section.
I'm currently doing a web based system for multiple organizations, so on my login form, there's 3 simple field:
Company code, such as CNN (so we can have same username, as long as they work in different company)
Username, such as james
Password
Now we are actually studying on the fingerprint authentication technology, on how it could help above.
Our assumption is below:
On our app, we provide user a registration screen, instead of username/password, they tap their thumb on the form, so we can get something, maybe a lengthy random string, which represents the thumbprint, then we pass this code to server, along with his profile, and registration completes.
Above repeats for thousands of our other users.
A user came to our app login screen, we show them a scanner, they put their thumbs on it, we send the retrieved fingerprint code, and send to server for a matching comparison, then we authenticate this user.
But from what we studied, it seems that the fingerprint SDK doesn't works this way, it simply authenticate if the user is the owner of the phone, and it does not provide us a code or something to represents the fingerprint.
Can anyone with experience in developing a working/deployed fingerprint app, share with me how does fingerprint helps in authenticating your user?
Thank you.
you should add this line in your manifest.xml - <uses-feature
android:name="android.hardware.fingerprint"
android:required="false" />
Here is the code sample to show fingerprint dialog and get result from user interaction:
private void showFingerPrintDialog() {
final FingerprintDialogBuilder dialogBuilder = new FingerprintDialogBuilder(ContextInstance)
.setTitle(R.string.fingerprint_dialog_title)
.setSubtitle(R.string.fingerprint_dialog_subtitle)
.setDescription(R.string.fingerprint_dialog_description)
.setNegativeButton(R.string.cancel);
dialogBuilder.show(getSupportFragmentManager(), new AuthenticationCallback() {
#Override
public void fingerprintAuthenticationNotSupported() {
Log.d(TAG, "fingerprintAuthenticationNotSupported: ");
}
#Override
public void hasNoFingerprintEnrolled() {
Log.d(TAG, "hasNoFingerprintEnrolled: ");
}
#Override
public void onAuthenticationError(int errorCode, #Nullable CharSequence errString) {
Log.d(TAG, "onAuthenticationError: ");
}
#Override
public void onAuthenticationHelp(int helpCode, #Nullable CharSequence helpString) {
Log.d(TAG, "onAuthenticationHelp: ");
}
#Override
public void authenticationCanceledByUser() {
Log.d(TAG, "authenticationCanceledByUser: ");
}
#Override
public void onAuthenticationSucceeded() {
Log.d(TAG, "onAuthenticationSucceeded: ");
/*SaveResult in db or preference*/
}
#Override
public void onAuthenticationFailed() {
Log.d(TAG, "onAuthenticationFailed: ");
}
});
}

Checkout Android Billing API getPurchaseHistory method question

Could you help to figure out what I'm doing wrong?
My goal is to obtain an Android subscription purchase history. To make this I using Android-checkout. So far the lib leverage was pretty straightforward. I managed to implement the purchase flow and access using
Inventory.Request
The next step in my business logic was to get a subscription history details.
Here is my code
Billing billing = new Billing(this, new Billing.DefaultConfiguration() {
#Override
public String getPublicKey() {
final Context applicationContext = getApplicationContext();
final Resources resources = applicationContext.getResources();
return resources.getString(R.string.google_play_key);
}
});
billing.connect()
billing.getRequests().isBillingSupported("<productId>")
isBillingSupported returns me BILLING_RESPONSE_RESULT_SERVICE_UNAVAILABLE (2)
when I try the following
billing.getRequests().getPurchases(<productId>,
null, new RequestListener<Purchases>() {
#Override
public void onSuccess(Purchases result) {
}
#Override
public void onError(int response, Exception e) {
}
});
The error callback method is returned and the error code is BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE (3)
Thanks in advance, probably it's worth getting switched to another library

Backendless setWhereClause Data Query returns FATAL EXCEPTION error

I'm trying to migrate a Parse project to Backendless.
Therefore, I'm following a Tutorial to learn Backendless.
The Tutorial is by Samantha Squires, and it's on Youtube.
What I'm building here is the ability to add 2 people as a friend.
I'm logged in as a testuser and I want to add a friend to my friend list.
Here's the method to add 2 friends as a friend in Backendless.
I get the following error message:
E/AndroidRuntime: FATAL EXCEPTION: IntentService[AddFriendService]
java.lang.NoClassDefFoundError: java.util.Objects
at com.backendless.Persistence.find(Persistence.java:638)
at com.backendless.DataStoreFactory$1.find(DataStoreFactory.java:188)
at com.example.muhammadahsan.a27sam01.AddFriendService.addFriends(AddFriendService.java:121)
at com.example.muhammadahsan.a27sam01.AddFriendService.onHandleIntent(AddFriendService.java:90)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:61)
My method to add 2 people as a friend is:
private void addFriends (String firstUserName, String secondUserName){
Log.i("addFriendsMethod: ", "addFriendsMethod is Running");
DataQueryBuilder query = DataQueryBuilder.create();
query.setWhereClause(String.format("name = '%s' or name = '%s'", firstUserName, secondUserName));
Backendless.Persistence.of(BackendlessUser.class).find(query, new AsyncCallback<List<BackendlessUser>>() {
#Override
public void handleResponse(List<BackendlessUser> response) {
Log.i("Query Response:" , response.toString());
List<BackendlessUser> users = response;
if (users.size() !=2){
broadcastAddFriendFailure();
//That means we have more that one users or one of users wasn't found
} else {
BackendlessUser user1 = users.get(0);//First user
final BackendlessUser user2 = users.get(1);//Second user
//Update first user, adding second user as a friend.
updateFriendsList(user1,user2);
Backendless.UserService.update(user1, new AsyncCallback<BackendlessUser>() {
#Override
public void handleResponse(BackendlessUser user) {
//Now Update second user adding first user as a friend
updateFriendsList(user2, user);//user is the updated version of user1
Backendless.UserService.update(user2, new AsyncCallback<BackendlessUser>() {
#Override
public void handleResponse(BackendlessUser response) {
broadcastAddFriendSuccess();
}
#Override
public void handleFault(BackendlessFault fault) {
broadcastAddFriendFailure();
}
});
}
#Override
public void handleFault(BackendlessFault fault) {
broadcastAddFriendFailure();
}
});
}
}
#Override
public void handleFault(BackendlessFault fault) {
}
});
}
I know there's something wrong with the
Backendless.Persistence.of(BackendlessUser.class).find(query, new AsyncCallback<List<BackendlessUser>>()
Because I tried to test the output of whereclause in logs.
Any help will be appreciated.
It seems that in order to use Backendless SDK you have to specify Android SDK 19+ as minimal. The reason is that the Objects class' static methods (which apparently Backendless SDK uses) are only available from this version.

Retrieving facebook friends returns empty list

I'm trying to retrieve a list of all friends, but it always returns a zero size list... No exception nor fail...
I'm using following permissions:
Permission[] permissions = new Permission[] {
Permission.BASIC_INFO,
Permission.READ_FRIENDLISTS
};
and I'm using following code:
private static OnFriendsListener mOnFriendsListener = new OnFriendsListener()
{
#Override
public void onComplete(List<Profile> friends)
{
L.d(FacebookHelper.class, "OnFriendsListener::onComplete");
BusProvider.getInstance().post(new FacebookEvent(Type.Friends, friends));
}
#Override
public void onException(Throwable throwable)
{
L.d(FacebookHelper.class, "OnFriendsListener::onException");
L.e(FacebookHelper.class, new Exception(throwable));
}
#Override
public void onThinking()
{
}
#Override
public void onFail(String reason)
{
L.d(FacebookHelper.class, "OnFriendsListener::onFail");
}
};
public static void getFriends(SimpleFacebook simpleFacebook)
{
PictureAttributes pictureAttributes = Attributes.createPictureAttributes();
pictureAttributes.setType(PictureType.SMALL);
Properties properties = new Properties.Builder()
.add(Properties.ID)
.add(Properties.FIRST_NAME)
.add(Properties.LAST_NAME)
.add(Properties.PICTURE, pictureAttributes)
.add(Properties.BIRTHDAY).build();
simpleFacebook.getFriends(properties, mOnFriendsListener);
}
Can anybody help me out with this problem?
Are you using the Facebook SDK for Android v3.14? If so, make sure to request the "user_friends" permission which lets the app read friends who also logged into the app with Facebook.
Note: v3.14 uses Graph API 2.0 by default. In that version of the API, GET /me/friends returns friends who logged into the app with Facebook.
If you're building a feature to tag friends in a post, take a look at the Taggable Friends API:
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/taggable_friends
More info on the 2.0 changes is here:
https://developers.facebook.com/docs/apps/changelog#v2_0_login

Categories

Resources