platanus / cordova-gigya

Cordova plugin that handles Gigya integration for mobile (iOS and Android) apps.
4 stars 4 forks source link

Login to facebook on Android #5

Open SPenskoy opened 9 years ago

SPenskoy commented 9 years ago

Using method from ReadMe (on Android platform):

cordova.plugins.CordovaGigya.login(
    "facebook", 
    null,
    function(user){
        console.log(user);
    },
    function(error){
        console.log(error)
    })

Getting object:

Object {data: Object, errorMessage: "Login with Facebook is supported only using Facebook SDK native login.", errorCode: 400006}
    data: Object
        provider: "facebook"
    errorCode: 400006
    errorMessage: "Login with Facebook is supported only using Facebook SDK native login."

Also I don't see Facebook in the list of providers when I'm using:

cordova.plugins.CordovaGigya.showLoginUI(
    ['twitter', 'facebook'],
    {
        cid: "context id"
    },
    function(user){
        console.log(user);
    },
    function(error){
        console.log(error)
    }) 

It is only twitter on the panel.

Other providers are working correctly for my login call.

blackjid commented 9 years ago

are you loading the Facebook Android SDK* on your project? this is requirement, and that is what the error is describing...

https://github.com/platanus/cordova-gigya#android

SPenskoy commented 9 years ago

Yes. I followed all instructions from ReadMe file and developers.facebook.com/docs/android/getting-started guide. Basically I have Ionic + cordova mobile application for android. So I imported project for Eclipse and added FacebookSDK reference. Now I have two issues with Ionic build and Eclipse. When I run application on android device with "Ionic run android" CLI I can see Popup with providers and execute login by click (now I can see Facebook icon too, but it takes me error javascript object with error code 400006). When I run application from Eclipse IDE I have errors in the LogCat on try to show loginUI:

D/CordovaGigya(13908): initialize
D/CordovaGigya(13908): showLoginUI
E/PluginManager(13908): Uncaught exception from plugin
E/PluginManager(13908): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.ionicframework.testapp371558/com.gigya.socialize.android.ui.HostActivity}; have you declared this activity in your AndroidManifest.xml?
E/PluginManager(13908):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1648)
E/PluginManager(13908):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1442)
E/PluginManager(13908):     at android.app.ContextImpl.startActivity(ContextImpl.java:1412)
E/PluginManager(13908):     at android.app.ContextImpl.startActivity(ContextImpl.java:1394)
E/PluginManager(13908):     at android.content.ContextWrapper.startActivity(ContextWrapper.java:322)
E/PluginManager(13908):     at com.gigya.socialize.android.ui.HostActivity.create(Unknown Source)
E/PluginManager(13908):     at com.gigya.socialize.android.login.ProviderSelection.show(Unknown Source)
E/PluginManager(13908):     at com.gigya.socialize.android.GSAPI.showUI(Unknown Source)
E/PluginManager(13908):     at com.gigya.socialize.android.GSAPI.showLoginUI(Unknown Source)
E/PluginManager(13908):     at us.platan.gigya.CordovaGigya.execute(CordovaGigya.java:69)
E/PluginManager(13908):     at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:84)
E/PluginManager(13908):     at org.apache.cordova.PluginManager.exec(PluginManager.java:147)
E/PluginManager(13908):     at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
E/PluginManager(13908):     at org.apache.cordova.ExposedJsApi.exec(ExposedJsApi.java:40)
E/PluginManager(13908):     at com.android.org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
E/PluginManager(13908):     at com.android.org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:27)
E/PluginManager(13908):     at android.os.Handler.dispatchMessage(Handler.java:102)
E/PluginManager(13908):     at android.os.Looper.loop(Looper.java:157)
E/PluginManager(13908):     at android.os.HandlerThread.run(HandlerThread.java:61)
E/GSAPI(13908): GSObject does not contain a value for key errorReportRules
E/GSAPI(13908): Unable to load config from server:*********** GSResponse Log ***********
E/GSAPI(13908): apiKey: ****************
E/GSAPI(13908): userKey: apiMethod: getSDKConfig
E/GSAPI(13908): params: {"enabledProviders":"","ucid":"c63bffcccba579c5","sdk":"android_3.1.2","format":"json","targetEnv":"mobile","apiKey":"****************","include":"permissions,ids"}
E/GSAPI(13908): useHTTPS: true
E/GSAPI(13908): sdk: android_3.1.2
E/GSAPI(13908): post_data: apiKey=****************&enabledProviders=&format=json&httpStatusCodes=false&include=permissions%2Cids&sdk=android_3.1.2&targetEnv=mobile&ucid=c63bffcccba579c5&
E/GSAPI(13908): url: https://socialize.us1.gigya.com/socialize.getSDKConfig
E/GSAPI(13908): server: web526
E/GSAPI(13908): raw_response: {  "errorMessage": "Internal server error",  "statusCode": 500,  "errorCode": 500001,  "statusReason": "Internal server error",  "callId": "303a0e498a9241b9978d23e649faa02c",  "time": "2015-02-17T16:52:47.284Z"}
E/GSAPI(13908): request_duration: 1848
E/GSAPI(13908): errorCode: 500001
E/GSAPI(13908): errorMessage: Internal server error
E/GSAPI(13908): errorDetails: 
blackjid commented 9 years ago

I also had some problems with the build after importing to eclipse. I ended up doing it without eclipse, but I didn't documented that on the readme.

Try reverting the changes that the eclipse import did to your code, then I think what I did was,

create a ant.properties file on platforms/android with

android.library.reference.1=CordovaLib
android.library.reference.2=<path_to_facebooksrc>/facebook-sdk
SPenskoy commented 9 years ago

I put facebook folder from full sdk into platform/android directory and created ant.properties file with content of

android.library.reference.1=CordovaLib
android.library.reference.2=facebook

But I have login to facebook issue with errorMessage: "Login with Facebook is supported only using Facebook SDK native login."

I have success builded application including jars from FacebookSDK. Attached my the build log:

Running command: "C:\Program Files\nodejs\node.exe" c:\GitHub\myapp\hooks\after_prepare\010_add_platform_class.js c:\GitHub\myapp
add to body class: platform-android
Running command: "C:\Program Files\nodejs\node.exe" c:\GitHub\myapp\hooks\after_prepare\020_remove_sass_from_platforms.js c:\GitHub\myapp
Running command: c:\GitHub\myapp\platforms\android\cordova\build.bat 
Buildfile: c:\GitHub\myapp\platforms\android\build.xml

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 24.0.2
 [checkenv] Installed at c:\AndroidSDK

-setup:
     [echo] Project Name: CordovaApp
  [gettype] Project Type: Application

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
     [echo] Resolving Build Target for CordovaApp...
[gettarget] Project Target:   Android 4.4.2
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
     [echo] ----------
     [echo] Resolving Dependencies for CordovaApp...
[dependency] Library dependencies:
[dependency] 
[dependency] ------------------
[dependency] Ordered libraries:
[dependency] 
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...

nodeps:

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 24.0.2
 [checkenv] Installed at c:\AndroidSDK

-setup:
     [echo] Project Name: CordovaApp
  [gettype] Project Type: Android Library

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
     [echo] Resolving Build Target for CordovaApp...
[gettarget] Project Target:   Google APIs
[gettarget] Vendor:           Google Inc.
[gettarget] Platform Version: 4.4.2
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
     [echo] ----------
     [echo] Resolving Dependencies for CordovaApp...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
    [javac] Compiling 1 source file to C:\GitHub\myapp\platforms\android\facebook\ant-build\classes
    [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    [javac] 3 warnings
     [echo] Creating library output jar file...

-post-compile:

-obfuscate:

-dex:
     [echo] Library project: do not convert bytecode...

-crunch:
   [crunch] Crunching PNG Files in source dir: C:\GitHub\myapp\platforms\android\facebook\res
   [crunch] To destination dir: C:\GitHub\myapp\platforms\android\facebook\ant-build\res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [echo] Library project: do not package resources...

-package:
     [echo] Library project: do not package apk...

-post-package:

-do-debug:
     [echo] Library project: do not create apk...
[propertyfile] Updating property file: C:\GitHub\myapp\platforms\android\facebook\ant-build\build.prop
[propertyfile] Updating property file: C:\GitHub\myapp\platforms\android\facebook\ant-build\build.prop
[propertyfile] Updating property file: C:\GitHub\myapp\platforms\android\facebook\ant-build\build.prop
[propertyfile] Updating property file: C:\GitHub\myapp\platforms\android\facebook\ant-build\build.prop

-post-build:

debug:

nodeps:

-set-mode-check:

-set-debug-files:

-check-env:
 [checkenv] Android SDK Tools Revision 24.0.2
 [checkenv] Installed at c:\AndroidSDK

-setup:
     [echo] Project Name: CordovaApp
  [gettype] Project Type: Android Library

-set-debug-mode:

-debug-obfuscation-check:

-pre-build:

-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
     [echo] Resolving Build Target for CordovaApp...
[gettarget] Project Target:   Google APIs
[gettarget] Vendor:           Google Inc.
[gettarget] Platform Version: 4.4.2
[gettarget] API level:        19
     [echo] ----------
     [echo] Creating output directories if needed...
     [echo] ----------
     [echo] Resolving Dependencies for CordovaApp...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency] 
[dependency] ------------------

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found new input file
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
     [echo] Creating library output jar file...

-post-compile:

-obfuscate:

-dex:
     [echo] Library project: do not convert bytecode...

-crunch:
   [crunch] Crunching PNG Files in source dir: C:\GitHub\myapp\platforms\android\CordovaLib\res
   [crunch] To destination dir: C:\GitHub\myapp\platforms\android\CordovaLib\ant-build\res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [echo] Library project: do not package resources...

-package:
     [echo] Library project: do not package apk...

-post-package:

-do-debug:
     [echo] Library project: do not create apk...
[propertyfile] Updating property file: C:\GitHub\myapp\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\GitHub\myapp\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\GitHub\myapp\platforms\android\CordovaLib\ant-build\build.prop
[propertyfile] Updating property file: C:\GitHub\myapp\platforms\android\CordovaLib\ant-build\build.prop

-post-build:

debug:

-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Found Deleted Target File
     [aapt] Generating resource IDs...
     [echo] ----------
     [echo] Handling BuildConfig class...
[buildconfig] No need to generate new BuildConfig.

-pre-compile:
     [echo] Set jars path to: C:\GitHub\myapp\platforms\android\CordovaLib\ant-build\classes.jar;C:\GitHub\myapp\platforms\android\facebook\ant-build\classes.jar;C:\GitHub\myapp\platforms\android\facebook\libs\bolts-android-1.1.2.jar;C:\GitHub\myapp\platforms\android\facebook\libs\android-support-v4.jar;c:\GitHub\myapp\platforms\android\libs\gigya-sdk-3.1.2.jar

-compile:
    [javac] Compiling 3 source files to c:\GitHub\myapp\platforms\android\ant-build\classes
    [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
    [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
    [javac] 3 warnings

-post-compile:

-obfuscate:

-dex:
      [dex] input: c:\GitHub\myapp\platforms\android\ant-build\classes
      [dex] input: C:\GitHub\myapp\platforms\android\CordovaLib\ant-build\classes.jar
      [dex] input: C:\GitHub\myapp\platforms\android\facebook\ant-build\classes.jar
      [dex] input: C:\GitHub\myapp\platforms\android\facebook\libs\bolts-android-1.1.2.jar
      [dex] input: C:\GitHub\myapp\platforms\android\facebook\libs\android-support-v4.jar
      [dex] input: c:\GitHub\myapp\platforms\android\libs\gigya-sdk-3.1.2.jar
      [dex] Using Pre-Dexed classes-003a850a74ada53acaee1584a78a449e.jar <- C:\GitHub\myapp\platforms\android\CordovaLib\ant-build\classes.jar
      [dex] Using Pre-Dexed classes-51cb39e03ad8f9ff219a6615889c3130.jar <- C:\GitHub\myapp\platforms\android\facebook\ant-build\classes.jar
      [dex] Using Pre-Dexed bolts-android-1.1.2-41efd9516d4d4ff727ed743ba5e8431f.jar <- C:\GitHub\myapp\platforms\android\facebook\libs\bolts-android-1.1.2.jar
      [dex] Using Pre-Dexed android-support-v4-363da20a88f526ce80888faa93a63e4c.jar <- C:\GitHub\myapp\platforms\android\facebook\libs\android-support-v4.jar
      [dex] Using Pre-Dexed gigya-sdk-3.1.2-d7cc68f5b5b4488eb9f604e3b5eedb0d.jar <- c:\GitHub\myapp\platforms\android\libs\gigya-sdk-3.1.2.jar
      [dex] Found Deleted Target File
      [dex] Converting compiled files and external libraries into c:\GitHub\myapp\platforms\android\ant-build\classes.dex...
       [dx] Merged dex A (27 defs/25.1KiB) with dex B (209 defs/316.7KiB). Result is 236 defs/414.3KiB. Took 0.1s
       [dx] Merged dex A (236 defs/414.3KiB) with dex B (413 defs/527.0KiB). Result is 649 defs/1173.3KiB. Took 0.1s
       [dx] Merged dex A (649 defs/1173.3KiB) with dex B (37 defs/45.3KiB). Result is 686 defs/1612.3KiB. Took 0.0s
       [dx] Result compacted from 3116.9KiB to 1493.0KiB to save 1623.9KiB
       [dx] Merged dex A (686 defs/1612.3KiB) with dex B (628 defs/645.6KiB). Result is 1314 defs/1493.0KiB. Took 0.1s
       [dx] Merged dex A (1314 defs/1493.0KiB) with dex B (119 defs/145.3KiB). Result is 1433 defs/2005.8KiB. Took 0.1s

-crunch:
   [crunch] Crunching PNG Files in source dir: c:\GitHub\myapp\platforms\android\res
   [crunch] To destination dir: c:\GitHub\myapp\platforms\android\ant-build\res
   [crunch] Crunched 0 PNG files to update cache

-package-resources:
     [aapt] Found Deleted Target File
     [aapt] Creating full resource package...
     [aapt]     (skipping file '.bower.json' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.bower.json' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.bower.json' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.bowerrc' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.gitattributes' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.gitignore' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.travis.yml' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.bower.json' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.bower.json' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.bower.json' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.gitignore' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.bower.json' due to ANDROID_AAPT_IGNORE pattern '.*')
     [aapt]     (skipping file '.bower.json' due to ANDROID_AAPT_IGNORE pattern '.*')

-package:
[apkbuilder] Found Deleted Target File
[apkbuilder] Creating CordovaApp-debug-unaligned.apk and signing it with a debug key...

-post-package:

-do-debug:
 [zipalign] Running zip align on final apk...
     [echo] Debug Package: c:\GitHub\myapp\platforms\android\ant-build\CordovaApp-debug.apk
[propertyfile] Updating property file: c:\GitHub\myapp\platforms\android\ant-build\build.prop
[propertyfile] Updating property file: c:\GitHub\myapp\platforms\android\ant-build\build.prop
[propertyfile] Updating property file: c:\GitHub\myapp\platforms\android\ant-build\build.prop
[propertyfile] Updating property file: c:\GitHub\myapp\platforms\android\ant-build\build.prop

-post-build:
     [move] Moving 1 file to c:\GitHub\myapp\platforms\android\ant-build
     [move] Moving 1 file to c:\GitHub\myapp\platforms\android\CordovaLib\ant-build

debug:

BUILD SUCCESSFUL
Total time: 6 seconds
Built the following apk(s):
    c:\GitHub\myapp\platforms\android\ant-build\CordovaApp-debug.apk
blackjid commented 9 years ago

you should have your FB_APP_ID in the platforms/android/res/values/string.xml file?

should have something like this...

<string name="facebook_app_id">483485723457</string>
SPenskoy commented 9 years ago

Yes, I have similar row in my string.xml and it writes in the file during of build/run. But it's not help with facebook login issue. Maybe I could find any indication of linked FacebookSDK in runtime debug or execute any facebook sdk method to check it?

SPenskoy commented 9 years ago

After some experiments I got working Facebook login but with one issue: it doesn't work on the first try of my button click - I have "Login with Facebook is supported only using Facebook SDK native login" in my onError callback. On the second and others click is execute facebook login form. Other providers work regulary. After application restart the first execution is not working, only second. In my click method I have initialize and login by the next command:

cordova.plugins.CordovaGigya.initialize(apiKey);
cordova.plugins.CordovaGigya.login(
    "twitter", 
    null,
    function(user){
        console.log(user);
    },
    function(error){
        console.log(error)
    })
blackjid commented 9 years ago

well it makes sense. On the android gigya sdk, the initialize method doesn't have any callback, so I'm calling the cordova success handler right after calling the native initialize.

Probably the initialize method is not really ready when you call the login method. Could you try to move the initialize call outside the click handler.... You can add it to your application initialization, as this methods should be called only onces at the beginning...

If you want a quick test (not the definitive solution) you can try this in your click handler...

cordova.plugins.CordovaGigya.initialize(apiKey);
setTimeout(function(){
    cordova.plugins.CordovaGigya.login(
        "twitter", 
        null,
        function(user){
            console.log(user);
        },
        function(error){
            console.log(error)
        })
}, 2000)
SPenskoy commented 9 years ago

I have very strange results of quick test: -add timeout 2000 + initialize script every click = all clicks were error -add timeout 2000 + initialize script once at application run = all clicks were error -initialize script once at application run + not used timeout = all clicks were error -return to initialize script every click without timeouts = error on the first click and next clicks are successed All of these changes did not influence on others providers scuccessfull work.

blackjid commented 9 years ago

wierd...

can you run adb logcat to get some android logs while the application boots and the when you click?

SPenskoy commented 9 years ago

It's a log when second click on facebook is working:

start
02-25 15:13:33.679: I/CordovaLog(32328): Changing log level to DEBUG(3)
02-25 15:13:33.680: D/CordovaActivity(32328): CordovaActivity.init()
02-25 15:13:33.793: I/WebViewFactory(32328): Loading com.google.android.webview version 37 (1602158-arm) (code 111201)
02-25 15:13:33.802: I/LibraryLoader(32328): Loading: webviewchromium
02-25 15:13:33.805: I/LibraryLoader(32328): Time to load native libraries: 3 ms (timestamps 1700-1703)
02-25 15:13:33.805: I/LibraryLoader(32328): Expected native library version number "",actual native library version number ""
02-25 15:13:33.819: V/WebViewChromiumFactoryProvider(32328): Binding Chromium to main looper Looper (main, tid 1) {38e14a6b}
02-25 15:13:33.820: I/LibraryLoader(32328): Expected native library version number "",actual native library version number ""
02-25 15:13:33.820: I/chromium(32328): [INFO:library_loader_hooks.cc(106)] Chromium logging enabled: level = 0, default verbosity = 0
02-25 15:13:33.827: I/BrowserStartupController(32328): Initializing chromium process, renderers=0
02-25 15:13:33.828: W/art(32328): Attempt to remove local handle scope entry from IRT, ignoring
02-25 15:13:33.843: W/chromium(32328): [WARNING:resource_bundle.cc(315)] locale_file_path.empty()
02-25 15:13:33.844: I/chromium(32328): [INFO:aw_browser_main_parts.cc(63)] Load from apk succesful, fd=32 off=46780 len=2953
02-25 15:13:33.844: I/chromium(32328): [INFO:aw_browser_main_parts.cc(78)] Loading webviewchromium.pak from, fd:33 off:229484 len:643667
02-25 15:13:33.855: W/AudioManagerAndroid(32328): Requires BLUETOOTH permission
02-25 15:13:33.862: I/Adreno-EGL(32328): <qeglDrvAPI_eglInitialize:410>: QUALCOMM Build: 10/24/14, 167c270, I68fa98814b
02-25 15:13:33.921: W/chromium(32328): [WARNING:proxy_service.cc(901)] PAC support disabled because there is no system implementation
02-25 15:13:33.923: W/chromium(32328): [WARNING:data_reduction_proxy_settings.cc(403)] SPDY proxy OFF at startup
02-25 15:13:33.936: W/art(32328): Attempt to remove local handle scope entry from IRT, ignoring
02-25 15:13:33.940: W/AwContents(32328): onDetachedFromWindow called when already detached. Ignoring
02-25 15:13:33.953: D/CordovaWebView(32328): CordovaWebView is running on device made by: LGE
02-25 15:13:33.958: W/art(32328): Attempt to remove local handle scope entry from IRT, ignoring
02-25 15:13:33.958: W/art(32328): Attempt to remove local handle scope entry from IRT, ignoring
02-25 15:13:33.958: D/CordovaActivity(32328): CordovaActivity.createViews()
02-25 15:13:33.964: D/CordovaWebView(32328): >>> loadUrl(file:///android_asset/www/index.html)
02-25 15:13:33.964: D/PluginManager(32328): init()
02-25 15:13:33.965: D/CordovaWebView(32328): >>> loadUrlNow()
02-25 15:13:33.977: D/CordovaActivity(32328): Resuming the App
02-25 15:13:33.984: D/OpenGLRenderer(32328): Render dirty regions requested: true
02-25 15:13:33.994: D/Atlas(32328): Validating map...
02-25 15:13:34.009: D/SoftKeyboardDetect(32328): Ignore this event
02-25 15:13:34.036: I/OpenGLRenderer(32328): Initialized EGL, version 1.4
02-25 15:13:34.040: D/OpenGLRenderer(32328): Enabling debug mode 0
02-25 15:13:34.058: D/SoftKeyboardDetect(32328): Ignore this event
02-25 15:13:34.090: D/SoftKeyboardDetect(32328): Ignore this event
02-25 15:13:34.103: D/CordovaWebViewClient(32328): onPageStarted(file:///android_asset/www/index.html)
02-25 15:13:34.104: D/CordovaActivity(32328): onMessage(onPageStarted,file:///android_asset/www/index.html)
02-25 15:13:34.664: D/JsMessageQueue(32328): Set native->JS mode to OnlineEventsBridgeMode
02-25 15:13:35.032: D/CordovaWebViewClient(32328): onPageFinished(file:///android_asset/www/index.html#/login)
02-25 15:13:35.032: D/CordovaActivity(32328): onMessage(onPageFinished,file:///android_asset/www/index.html#/login)
02-25 15:13:35.158: I/chromium(32328): [INFO:SkUtilsArm.cpp(179)] Device supports ARM NEON instructions!
02-25 15:13:35.393: D/CordovaActivity(32328): onMessage(spinner,stop)
02-25 15:13:35.468: I/App(32328): WARNING: Back Button Default Behavior will be overridden.  The backbutton event will be fired!
02-25 15:13:37.037: D/CordovaActivity(32328): onMessage(spinner,stop)

first tap
02-25 15:14:11.694: D/CordovaGigya(32328): initialize
02-25 15:14:11.702: I/art(32328): Rejecting re-init on previously-failed class java.lang.Class<com.gigya.socialize.android.login.providers.GooglePlusProvider$2>
02-25 15:14:11.702: I/art(32328): Rejecting re-init on previously-failed class java.lang.Class<com.gigya.socialize.android.login.providers.GooglePlusProvider$2>
02-25 15:14:11.728: W/PluginManager(32328): THREAD WARNING: exec() call to CordovaGigya.initialize blocked the main thread for 34ms. Plugin should use CordovaInterface.getThreadPool().
02-25 15:14:11.731: D/CordovaGigya(32328): login
02-25 15:14:12.439: E/GSAPI(32328): Error Response: 
02-25 15:14:12.439: E/GSAPI(32328): *********** GSResponse Log ***********
02-25 15:14:12.446: D/CordovaLog(32328): file:///android_asset/www/js/myApp.js: Line 382 : [object Object]
02-25 15:14:12.446: I/chromium(32328): [INFO:CONSOLE(382)] "[object Object]", source: file:///android_asset/www/js/myApp.js (382)

second tap
02-25 15:14:36.553: D/CordovaGigya(32328): initialize
02-25 15:14:36.558: D/CordovaGigya(32328): login
02-25 15:14:36.570: D/CordovaActivity(32328): Paused the application!
02-25 15:14:36.570: D/CordovaWebView(32328): Handle the pause
02-25 15:14:36.578: W/PluginManager(32328): THREAD WARNING: exec() call to CordovaGigya.login blocked the main thread for 20ms. Plugin should use CordovaInterface.getThreadPool().
02-25 15:14:36.615: E/ActivityThread(32328): Failed to find provider info for com.facebook.katana.provider.AttributionIdProvider
02-25 15:14:36.684: E/ActivityThread(32328): Failed to find provider info for com.facebook.katana.provider.PlatformProvider
02-25 15:14:36.685: E/ActivityThread(32328): Failed to find provider info for com.facebook.wakizashi.provider.PlatformProvider
02-25 15:14:36.699: W/art(32328): Attempt to remove local handle scope entry from IRT, ignoring
02-25 15:14:36.702: W/AwContents(32328): onDetachedFromWindow called when already detached. Ignoring
02-25 15:14:36.834: D/FacebookSDK.WebDialog(32328): Webview loading URL: https://m.facebook.com/v2.2/dialog/oauth?client_id=..............
02-25 15:14:36.853: W/chromium(32328): [WARNING:simple_index_file.cc(337)] Could not map Simple Index file.
02-25 15:14:37.615: D/FacebookSDK.WebDialog(32328): Webview loading URL: https://m.facebook.com/login.php?skip_api_login=1&api_key=..........
02-25 15:14:37.618: D/FacebookSDK.WebDialog(32328): Redirect URL: https://m.facebook.com/login.php?skip_api_login=1&api_key=...........
blackjid commented 9 years ago

any idea why this line?

02-25 15:14:11.702: I/art(32328): Rejecting re-init on previously-failed class java.lang.Class<com.gigya.socialize.android.login.providers.GooglePlusProvider$2>

are you using the google plus provider? are you initializing on other place??

SPenskoy commented 9 years ago

With google provider login works well. It's log of using facebook provider and it is variant when it works on the second tap. Other variants to separate initialize and login or do initialize only once doesn't work with facebook. So I traced only one working for me state.

part of my view:

<div class="social-logins">
            <div class="row">
              <div class="col facebook"><button id="btnFacebook" class="button button-block" ng-click="ctrl.socialLogin('facebook')"><i class="fa fa-facebook"></i> Facebook</button></div>
              <div class="col twitter"><button id="btnTwitter" class="button button-block" ng-click="ctrl.socialLogin('twitter')"><i class="fa fa-twitter"></i> Twitter</button></div>
            </div>
            <div class="row">
              <div class="col google"><button class="button button-block" ng-click="ctrl.socialLogin('google')"><i class="fa fa-google"></i> Google+</button></div>
              <div class="col yahoo"><button class="button button-block" ng-click="ctrl.socialLogin('yahoo')"><i class="fa fa-yahoo"></i> Yahoo</button></div>
            </div>
            <div class="row">
              <div class="col linkedin"><button class="button button-block" ng-click="ctrl.socialLogin('linkedin')"><i class="fa fa-linkedin"></i> LinkedIn</button></div>
              <div class="col instagram"><button class="button button-block" ng-click="ctrl.socialLogin('instagram')"><i class="fa fa-instagram"></i> Instagram</button></div>
            </div>

It's my click social network buttons handler:

LoginController.prototype.socialLogin = function(provider) {
        var $state = this.$state;
        var config = this.myConfig;
        cordova.plugins.CordovaGigya.initialize(config.gigya_api_key);
        cordova.plugins.CordovaGigya.login(
            provider,
            null,
            function(user){
                    console.log(user);
                    return $state.transitionTo('app.home');                
            },
            function(error){
                console.log(error)
            })
      };

When I separate initialize and do it once on the application start facebook provider login doesn't work independence from button click times. All another providers work always.

sachinshah391 commented 1 year ago

I'm getting error while trying to install this Plugin. can you help here

cordova plugin add https://github.com/platanus/cordova-gigya Failed to fetch plugin https://github.com/platanus/cordova-gigya via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. CordovaError: Error: ENOENT: no such file or directory

sachinshah391 commented 1 year ago

I'm getting error while trying to install this Plugin. can you help here

cordova plugin add https://github.com/platanus/cordova-gigya Failed to fetch plugin https://github.com/platanus/cordova-gigya via registry. Probably this is either a connection problem, or plugin spec is incorrect. Check your connection and plugin name/version/URL. CordovaError: Error: ENOENT: no such file or directory