"CONNECTIVITY_ISSUE" error while using android-uber-sdk - android

I am receiving an authentication error "CONNECTIVITY_ISSUE" when I try to login using android sdk LoginManager in sandbox mode.
SessionConfiguration config = new SessionConfiguration.Builder()
.setClientId(Constants.UBER_CLIENTID)
.setEnvironment(SessionConfiguration.Environment.SANDBOX)
.setScopes(Arrays.asList(Scope.PROFILE, Scope.RIDE_WIDGETS,Scope.REQUEST))
.build();
UberSdk.initialize(config);
accessTokenManager = new AccessTokenManager(this);
LoginCallback loginCallback = new LoginCallback() {
#Override
public void onLoginCancel() {
}
#Override
public void onLoginError(#NonNull AuthenticationError error) {
}
#Override
public void onLoginSuccess(#NonNull AccessToken accessToken) {
}
#Override
public void onAuthorizationCodeReceived(#NonNull String authorizationCode) {
authorizationCode=authorizationCode;
}
};
loginManager = new LoginManager(accessTokenManager, loginCallback);
if (accessTokenManager.getAccessToken() == null) {
loginManager.setRedirectForAuthorizationCode(true);
loginManager.login(this);
}
I have followed uber developer documentation and I am not able to solve this error. Can anyone help me on this?

Looks like you are missing the redirect uri from your SessionConfiguration, try adding it in like this:
.setRedirectUri("YOUR_REDIRECT_URI").
More information in the readme

Related

Unable to login using facebook in android

I am using Facebook login in my app. Previously it was worked fine, that app is also is in play store. But from fast few days i am unable to login with Facebook.
cureently am getting this error.
We have using fallowing code in my app
implementation 'com.facebook.android:facebook-login:5.0.0'
loginButton.setReadPermissions(Arrays.asList("Email", "public_profile"));
callbackManager = CallbackManager.Factory.create();
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
#Override
public void onSuccess(LoginResult loginResult) {
getUserProfile(loginResult);
}
#Override
public void onCancel() {
}
#Override
public void onError(FacebookException exception) {
}
});
private void getUserProfile(LoginResult currentAccessToken) {
GraphRequest request = GraphRequest.newMeRequest(
currentAccessToken.getAccessToken(), (object, response) -> {
try {
firstName = object.getString(Constants.FACEBOOK.FIRST_NAME);
lastName = object.getString(Constants.FACEBOOK.LAST_NAME);
email = object.optString(Constants.FACEBOOK.EMAIL, "");
id = object.getString(Constants.FACEBOOK.ID);
imageUrl = String.format(getString(R.string.profile_pic_url), id);
if (TextUtils.isEmpty(email)) {
fbSigUp = true;
//facebook to getting email null
gettingEmail(null);
} else {
loginWS();
}
} catch (JSONException e) {
e.printStackTrace();
}
});
Bundle parameters = new Bundle();
parameters.putString(getString(R.string.field), getString(R.string.fbrequiedfields));
request.setParameters(parameters);
request.executeAsync();
}
So can anybody help me to figure it out.

How to Check Facebook invite app to friends is successfully sent invitation or not sent in android [duplicate]

In the new Fb SDK 4.0 for Android you can register a callback for the LoginButton according to the docs. https://developers.facebook.com/docs/facebook-login/android/v2.3
The question is is this possible for the AppInviteDialog as well? Or is there any other way to identify if the App-Invite was successful or not?
Yes, this is possible.
public static void openDialogInvite(final Activity activity)
{
String appLinkUrl, previewImageUrl;
appLinkUrl = "your app link url";
previewImageUrl = "https://www.example.com/my_invite_image.jpg";
if (AppInviteDialog.canShow())
{
AppInviteContent content = new AppInviteContent.Builder()
.setApplinkUrl(appLinkUrl)
.setPreviewImageUrl(previewImageUrl)
.build();
AppInviteDialog appInviteDialog = new AppInviteDialog(activity);
CallbackManager sCallbackManager = CallbackManager.Factory.create();
appInviteDialog.registerCallback(sCallbackManager, new FacebookCallback<AppInviteDialog.Result>()
{
#Override
public void onSuccess(AppInviteDialog.Result result)
{
}
#Override
public void onCancel()
{
}
#Override
public void onError(FacebookException e)
{
}
});
appInviteDialog.show(content);
}
}

Get Twitter user email using Fabric SDK

I'm logging in with twitter using Fabric.
This is how I fetch the user data:
loginButton.setCallback(new Callback<TwitterSession>() {
#Override
public void success(Result<TwitterSession> result) {
// Do something with result, which provides a TwitterSession for making API calls
AccountService ac = Twitter.getApiClient(result.data).getAccountService();
ac.verifyCredentials(true, true, new Callback<com.twitter.sdk.android.core.models.User>() {
#Override
public void success(Result<com.twitter.sdk.android.core.models.User> result) {
String imageUrl = result.data.profileImageUrl;
String email = result.data.email;
String userName = result.data.name;
System.out.println(imageUrl);
System.out.println(email);
System.out.println(userName);
}
#Override
public void failure(TwitterException e) {
}
});
}
This is working fine, except that the email variable is null when I print to log. Is there an other way of fetching the user email?
-Here is the Solution!
twitauthobj.requestEmail(twitsessionobj,new Callback<String>() {
#Override
public void success(Result<String> stringResult) {
'You code here'
}
#Override
public void failure(TwitterException e) {
}
});
-Thanks let me inform if t doesnt work!
To bypass Twitter's useless request email activity and to fix a leak, I dug through the source code and pulled this out:
new Retrofit.Builder()
.client(getClient(sessionResult))
.baseUrl(new TwitterApi().getBaseHostUrl())
.addConverterFactory(getFactory())
.build()
.create(EmailService.class)
.getEmail()
.enqueue(new Callback<User>() {
#Override
public void success(Result<User> result) {
String email = result.data.email;
// Handle the result
if (email == null) {
TwitterProvider.this.failure(
new TwitterException("Your application may not have access to"
+ " email addresses or the user may not have an email address. To request"
+ " access, please visit https://support.twitter.com/forms/platform."));
} else if (email.equals("")) {
TwitterProvider.this.failure(
new TwitterException("This user does not have an email address."));
} else {
mCallbackObject.onSuccess(createIdpResponse(sessionResult.data, email));
}
}
#Override
public void failure(TwitterException exception) {
TwitterProvider.this.failure(exception);
}
});
private OkHttpClient getClient(Result<TwitterSession> sessionResult) {
return OkHttpClientHelper.getOkHttpClient(
sessionResult.data,
TwitterCore.getInstance().getAuthConfig(),
TwitterCore.getInstance().getSSLSocketFactory());
}
private GsonConverterFactory getFactory() {
return GsonConverterFactory.create(
new GsonBuilder()
.registerTypeAdapterFactory(new SafeListAdapter())
.registerTypeAdapterFactory(new SafeMapAdapter())
.registerTypeAdapter(BindingValues.class, new BindingValuesAdapter())
.create());
}
EmailService:
interface EmailService {
#GET("/1.1/account/verify_credentials.json?include_email=true?include_entities=true?skip_status=true")
Call<User> getEmail();
}

Android-simple-facebook lib, get user birthday date

The question in github
I'm using android-simple-facebook lib to make login in facebook and get some user data.
In this case the problem that I'm facing is that I can't get the user's birthdate data.
I've set the permissions to the SimpleFacebookConfiguration object
private Permission[] permissions = new Permission[]{
Permission.EMAIL,
Permission.USER_BIRTHDAY,
Permission.PUBLIC_PROFILE,
Permission.PUBLISH_ACTION
};
and this profile's permissions to get the data
Profile.Properties properties = new Profile.Properties.Builder()
.add(Profile.Properties.ID)
.add(Profile.Properties.FIRST_NAME)
.add(Profile.Properties.LAST_NAME)
.add(Profile.Properties.BIRTHDAY)
.add(Profile.Properties.AGE_RANGE)
.add(Profile.Properties.EMAIL)
.add(Profile.Properties.GENDER)
.build();
But I can't get the data from any of them. Any idea?
To request for new permission
private Permission[] permissions = new Permission[]{
Permission.EMAIL,
Permission.USER_BIRTHDAY,
};
SimpleFacebook.getInstance().requestNewPermissions(permissions, new OnNewPermissionsListener() {
#Override
public void onFail(String reason) {
//mResult.setText(reason);
System.out.println(""+reason);
}
#Override
public void onException(Throwable throwable) {
// mResult.setText(throwable.getMessage());
System.out.println(""+throwable.getMessage());
}
#Override
public void onCancel() {
}
#Override
public void onSuccess(String accessToken, List<Permission> acceptedPermissions, List<Permission> declinedPermissions) {
// showGrantedPermissions();
mSimpleFacebook.getProfile(properties, onProfileListener);
if (declinedPermissions != null && declinedPermissions.size() > 0) {
Toast.makeText(LoginActivity.this, "User declined few permissions: " + declinedPermissions.toString(), Toast.LENGTH_SHORT).show();
}
}
});
Profile.Properties properties = new Profile.Properties.Builder()
.add(Profile.Properties.ID)
.add(Profile.Properties.FIRST_NAME)
.add(Profile.Properties.LAST_NAME)
.add(Profile.Properties.BIRTHDAY)
.add(Profile.Properties.AGE_RANGE)
.add(Profile.Properties.EMAIL)
.add(Profile.Properties.GENDER)
.build();

Log in on Facebook: app is misconfigured

I try to write an application that can log in facebook. I use easyfacebooksdk.jar like library to use your API, but I have problem with configuration. I post the follow image:
This is the facebook app that I have created:
I have obtained the key hash in this way from console:
I put this code here in key has field( i can't post the image because i don't have 10 reputation)
This is my code:
public class MainActivity extends Activity implements LoginListener {
private FBLoginManager fbManager;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
shareFacebook();
}
public void shareFacebook() {
//change the permissions according to the function you want to use
String permissions[] = { "read_stream", "user_relationship_details",
"user_religion_politics", "user_work_history",
"user_relationships", "user_interests", "user_likes",
"user_location", "user_hometown", "user_education_history",
"user_activities", "offline_access" };
//change the parameters with those of your application
fbManager = new FBLoginManager(this, R.layout.activity_main,
"334014040053829", permissions);
if (fbManager.existsSavedFacebook()) {
fbManager.loadFacebook();
} else {
fbManager.login();
}
}
#Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
fbManager.loginSuccess(data);
}
public void loginFail() {
fbManager.displayToast("Login failed!");
}
public void logoutSuccess() {
fbManager.displayToast("Logout success!");
}
public void loginSuccess(Facebook facebook) {
//library use example
GraphApi graphApi = new GraphApi(facebook);
User user = new User();
try {
user = graphApi.getMyAccountInfo();
graphApi.setStatus("Post by app");
} catch (EasyFacebookError e) {
e.toString();
}
}
}
I obtain this error in emulator: app is misconfigured to facebook log in but i don't understand why... Someone can you help me?

Categories

Resources