Android Parse Facebook Login JSON Null -
when have new user login through facebook on app, make newmerequest
in order grab information new user. code use working fine, lately i've noticed new user signups through facebook
on app have been lacking required data pulling facebook.
i noticed json newmerequest
turning out null
(i've been running code on test database using facebook profile on , on , deleting account test iteration) , sometimes it's not null.
additionally have been having issues lately app saying uh oh. user canceled facebook login
, doesn't happen 100% of time.
code portion of "uh oh....":
list<string> permissions = arrays.aslist("public_profile", "email"); parsefacebookutils.loginwithreadpermissionsinbackground(this, permissions, new logincallback() { @override public void done(parseuser user, parseexception err) { if (user == null) { log.d(application.tag, "uh oh. user cancelled facebook login."); } else if (user.isnew()) { log.d(application.tag, "user signed , logged in through facebook!"); updateuserinfo(); shownewfbactivity(); } else { log.d(application.tag, "user logged in through facebook!"); startactivity(new intent(welcomeactivity.this, dispatchactivity.class)); } } });
here code running request:
graphrequest request = graphrequest.newmerequest(accesstoken.getcurrentaccesstoken(), new graphrequest.graphjsonobjectcallback() { @override public void oncompleted(jsonobject jsonobject, graphresponse graphresponse) { if (jsonobject != null) { jsonobject userprofile = new jsonobject(); // fill in profile data..... } else if (graphresponse.geterror() != null) { switch (graphresponse.geterror().getcategory()) { case login_recoverable: log.d(application.tag, "authentication error: " + graphresponse.geterror()); break; case transient: log.d(application.tag, "transient error. try again. " + graphresponse.geterror()); break; case other: log.d(application.tag, "some other error: " + graphresponse.geterror()); break; }
when null print out error:
some other error:
{httpstatus: -1, errorcode: -1, errortype: null, errormessage: java.net.connectexception: failed connect graph.facebook.com/31.13.70.1 (port 443): connect failed: etimedout (connection timed out)}
here manifest , gradle if helps:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.juryroom.qollege_android_v1" > <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <!-- needed parse push --> <uses-permission android:name="android.permission.wake_lock" /> <uses-permission android:name="android.permission.receive_boot_completed" /> <uses-permission android:name="android.permission.vibrate" /> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="com.google.android.c2dm.permission.receive" /> <!-- important: change "com.parse.tutorials.pushnotifications.permission.c2d_message" in lines below match app's package name + ".permission.c2d_message". --> <permission android:name="com.juryroom.qollege_android_v1.permission.c2d_message" android:protectionlevel="signature" /> <uses-permission android:name="com.juryroom.qollege_android_v1.permission.c2d_message" /> <!-- auto-complete email text field in login form user's emails --> <uses-permission android:name="android.permission.get_accounts" /> <uses-permission android:name="android.permission.read_profile" /> <uses-permission android:name="android.permission.read_contacts" /> <!-- picture camera --> <uses-permission android:name="android.permission.read_external_storage" /> <uses-feature android:name="android.hardware.camera" android:required="false" /> <application android:name=".application" android:allowbackup="true" android:icon="@mipmap/qollege_icon" android:label="qollege" android:theme="@style/apptheme" > <meta-data android:name="com.facebook.sdk.applicationid" android:value="@string/facebook_app_id" /> <activity android:name="com.facebook.facebookactivity" android:configchanges="keyboard|keyboardhidden|screenlayout|screensize|orientation" android:label="@string/app_name" android:theme="@android:style/theme.translucent.notitlebar" /> <provider android:name="com.facebook.facebookcontentprovider" android:authorities="com.facebook.app.facebookcontentprovider1234" android:exported="true" /> <activity android:name=".dispatchactivity" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> .... more activities.... </application>
gradle:
buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' android { signingconfigs { config { keyalias '#######################' keypassword '##################' storefile file('#############################') storepassword '#########################' } } compilesdkversion 23 buildtoolsversion '23.0.1' defaultconfig { applicationid "com.juryroom.qollege_android_v1" minsdkversion 15 targetsdkversion 22 versioncode 4 versionname "1.6" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } repositories { mavencentral() maven { url 'https://maven.fabric.io/public' } maven { url "https://oss.sonatype.org/content/repositories/snapshots" } maven { url "https://jitpack.io" } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) //compile 'com.android.support:appcompat-v7:22.2.0' compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.parse.bolts:bolts-android:1.+' compile filetree(dir: 'libs', include: 'parse-*.jar') compile 'com.facebook.android:facebook-android-sdk:4.7.0' compile files('libs/parsefacebookutilsv4-1.9.1.jar') .............. more....................... }
Comments
Post a Comment