android - Facebook Login CallbackManager FacebookCallback called onCancel() every time -


i implementing login via facebook , user email id using sdk 4.1.0 shown in facebook documentation problem occurring every time after onactivityresult when registercallback called instead of onsuccess oncancel called.

package com.dexterous.hellologin;  import android.content.intent; import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.util.log;  import com.facebook.callbackmanager; import com.facebook.facebookcallback; import com.facebook.facebookexception; import com.facebook.facebooksdk; import com.facebook.login.loginresult; import com.facebook.login.widget.loginbutton;   public class mainactivity2 extends actionbaractivity {  callbackmanager callbackmanager;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);       facebooksdk.sdkinitialize(getapplicationcontext());     callbackmanager = callbackmanager.factory.create();      setcontentview(r.layout.activity_main_activity2);      loginbutton loginbutton = (loginbutton) findviewbyid(r.id.login_button);     loginbutton.setreadpermissions("email");     // if using in fragment     //   loginbutton.setfragment(this);     // other app specific specialization     // callback registration         loginbutton.registercallback(callbackmanager, new facebookcallback<loginresult>() {         @override         public void onsuccess(loginresult loginresult) {             // app code             log.e("tag", "success");         }          @override         public void oncancel() {             // app code             log.e("tag", "oncancel");         }          @override         public void onerror(facebookexception exception) {             // app code             log.e("tag", "error");         }     }); }  @override protected void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);     callbackmanager.onactivityresult(requestcode, resultcode, data);     log.e("tag", "onactivityresult");    } } 

every time getting output

onactivityresult

oncancel

neither getting facebook login screen containing buttons cancel , login.

after uninstall facebook app mobile error changed invalid app id

and stacktrace

06-04 10:55:16.631 19864-19864/com.dexterous.hellologin i/webviewfactory﹕ loading com.google.android.webview version 42.0.2311.138 (code 2311138) 06-04 10:55:16.706 19864-19864/com.dexterous.hellologin i/libraryloader﹕ time load native libraries: 4 ms (timestamps 8772-8776) 06-04 10:55:16.706 19864-19864/com.dexterous.hellologin i/libraryloader﹕ expected native library version number "",actual native library version number "" 06-04 10:55:16.717 19864-19864/com.dexterous.hellologin w/art﹕ attempt remove local handle scope entry irt, ignoring 06-04 10:55:16.816 19864-19864/com.dexterous.hellologin v/webviewchromiumfactoryprovider﹕ binding chromium main looper looper (main, tid 1) {28a6fbd9} 06-04 10:55:16.816 19864-19864/com.dexterous.hellologin i/libraryloader﹕ expected native library version number "",actual native library version number "" 06-04 10:55:16.819 19864-19864/com.dexterous.hellologin i/chromium﹕ [info:library_loader_hooks.cc(112)] chromium logging enabled: level = 0, default verbosity = 0 06-04 10:55:16.834 19864-19864/com.dexterous.hellologin i/browserstartupcontroller﹕ initializing chromium process, singleprocess=true 06-04 10:55:16.838 19864-19864/com.dexterous.hellologin w/art﹕ attempt remove local handle scope entry irt, ignoring 06-04 10:55:16.841 19864-19864/com.dexterous.hellologin e/sysutils﹕ applicationcontext null in applicationstatus 06-04 10:55:16.869 19864-19864/com.dexterous.hellologin w/chromium﹕ [warning:resource_bundle.cc(286)] locale_file_path.empty() 06-04 10:55:16.870 19864-19864/com.dexterous.hellologin i/chromium﹕ [info:aw_browser_main_parts.cc(63)] load apk succesful, fd=63 off=46992 len=3337 06-04 10:55:16.871 19864-19864/com.dexterous.hellologin i/chromium﹕ [info:aw_browser_main_parts.cc(76)] loading webviewchromium.pak from, fd:64 off:7953032 len:1161174 06-04 10:55:17.024 19864-19953/com.dexterous.hellologin w/chromium﹕ [warning:data_reduction_proxy_config.cc(150)] spdy proxy off @ startup 06-04 10:55:17.047 19864-19864/com.dexterous.hellologin w/art﹕ attempt remove local handle scope entry irt, ignoring 06-04 10:55:17.060 19864-19864/com.dexterous.hellologin w/awcontents﹕ ondetachedfromwindow called when detached. ignoring 06-04 10:55:24.893 19864-19864/com.dexterous.hellologin w/bindingmanager﹕ cannot call determinedvisibility() - never saw connection pid: 19864 06-04 10:55:26.140 19864-20020/com.dexterous.hellologin e/adreno-es20﹕ : invalid texture format! returning error! 06-04 10:55:26.140 19864-20020/com.dexterous.hellologin e/adreno-es20﹕ : framebuffer color attachment incomplete. returning gl_framebuffer_incomplete_attachment! 06-04 10:55:26.198 19864-19912/com.dexterous.hellologin e/adreno-es20﹕ : invalid texture format! returning error! 06-04 10:55:26.198 19864-19912/com.dexterous.hellologin e/adreno-es20﹕ : framebuffer color attachment incomplete. returning gl_framebuffer_incomplete_attachment! 06-04 10:58:32.287 19864-19864/com.dexterous.hellologin e/tag﹕ oncancel 06-04 10:58:32.287 19864-19864/com.dexterous.hellologin e/tag﹕ onactivityresult 06-04 10:59:25.498 19864-19864/com.dexterous.hellologin i/art﹕ explicit concurrent mark sweep gc freed 16056(1325kb) allocspace objects, 0(0b) los objects, 39% free, 9mb/16mb, paused 856us total 79.028ms

manifest

<uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.bluetooth"/>  <application     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:theme="@style/apptheme" >      <activity         android:name="com.dexterous.hellologin.mainactivity2"         android:label="@string/app_name" >         <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter>     </activity>     <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" />     <activity         android:name=".mainactivity"         android:label="@string/title_activity_main_activity2" >     </activity>      <meta-data     android:name="com.facebook.sdk.applicationid"     android:value="1437829111203883" />  </application>  </manifest> 

problem here using facebook appid directly , should use this

<meta-data         android:name="com.facebook.sdk.applicationid"         android:value="@string/app_id" /> 

in sting xml

<string name="app_id">1437829111203883 </string> 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

spring cloud - How to configure SpringCloud Eureka instance to point to https on non standard port -

Magento/PHP - Get phones on all members in a customer group -