0
votes

I'm new to Worklight and I have been trying to run this example: Using IBM Worklight HTTP Adapters with REST/JSON Services.

When I run the app on an android emulator and I click a button, I got the following error: alert("mobGmapLatLngFailure"); in the app

in logcat errors: 02-09 04:05:21.924: D/NONE(1435): Client registration failed with error: {"responseHeaders":{},"status":500,"responseText":"","invocationContext":null} 02-09 04:05:22.074: E/NONE(1435): [/apps/services/api/AdapterApp/android/query] failure. state: 500, response: undefined –

Here is the code:

<!DOCTYPE HTML>
  <html>
     <head>
          <meta charset="UTF-8">
          <title>AdaptersApp</title>
            <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
        <!--
            <link rel="shortcut icon" href="images/favicon.png">
            <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> 
        -->
        <link rel="stylesheet" href="css/main.css">
        <script>window.$ = window.jQuery = WLJQ;</script>
        <script>
        function mobGmapLatLng(pAddress) {
                var invocationData = {
                        adapter : 'myRESTAdapter',
                        procedure : 'getGmapLatLng',
                        parameters : [ pAddress ]
                    };

                WL.Client.invokeProcedure(invocationData,{
                    onSuccess : mobGmapLatLngSuccess,
                    onFailure : mobGmapLatLngFailure,
                });
            }

            function mobGmapLatLngSuccess(result) {
                var httpStatusCode = result.status;
                if (200 == httpStatusCode) {
                    var invocationResult = result.invocationResult;
                    var isSuccessful = invocationResult.isSuccessful;
                    if (true == isSuccessful) {
                        var lat = invocationResult.lat;
                        var lng = invocationResult.lng;
                        alert("Success: lat=" + lat + " lng=" + lng);
                    } 
                    else {
                        alert("Error. isSuccessful=" + isSuccessful);
                    }                    
                } 
                else {
                    alert("Error. httpStatusCode=" + httpStatusCode);
                }
            }

              function mobGmapLatLngFailure(result){
                alert("mobGmapLatLngFailure");
            }
        </script>
    </head>
    <body style="display: none;">
        <!--application UI goes here-->
        Hello MobileFirst
         Hello Worklight with getGmapLatLng
    <p>
    <button onclick="mobGmapLatLng( '11501 Burnet Rd, Austin, TX, USA' )">Austin, TX, USA</button>
    <p>
    <button onclick="mobGmapLatLng( '4250 South Miami Boulevard, Durham, NC, USA' )">Durham, NC, USA</button>
    <p>
    <button onclick="mobGmapLatLng( '1681 Route des Dolines, 06560 Valbonne, France' )">Valbonne, France</button>
    <p>
    <button onclick="mobGmapLatLng( 'Shefayim 60990, Israel' )">Shefayim, Israel</button>
    <p>
    <button onclick="mobGmapLatLng( '399 Ke Yuan Lu, Shanghai, China' )">Shanghai, China</button>
        <script src="js/initOptions.js"></script>
        <script src="js/main.js"></script>
        <script src="js/messages.js"></script>
    </body>

myRESTAdapter-impl.js

function getGmapLatLng(pAddress) {

var input = {
    method : 'get',
    returnedContentType : 'json',
    path : 'maps/api/geocode/json',
    parameters : {
        'address' : pAddress,
        'sensor' : 'false'   // hard-coded
    }
};

 // return WL.Server.invokeHttp(input);
var response =  WL.Server.invokeHttp(input);
var type = typeof response;
if ("object" == type) {
    if (true == response["isSuccessful"]) {

        // Drill down into the response object.
        var results = response["results"];
        var result = results[0];
        var geometry = result["geometry"];
        var location = geometry["location"];

        // Return JSON object with lat and lng.
        return location;
    }
    else {
        // Returning null. Web request was not successful.
        return null;
    }
}
else {
    // Returning null. Response is not an object.
    return null;
}


 }

myRESTAdapter.xml

        <domain>maps.googleapis.com</domain>



<procedure name="getGmapLatLng"/>

Logcat

02-18 03:28:44.460: D/dalvikvm(925): Not late-enabling CheckJNI (already on)

02-18 03:28:45.750: I/dalvikvm(925): Could not find method android.content.Context.getNoBackupFilesDir, referenced from method com.worklight.nativeandroid.common.WLUtils.getNoBackupFilesDir 02-18 03:28:45.750: W/dalvikvm(925): VFY: unable to resolve virtual method 147: Landroid/content/Context;.getNoBackupFilesDir ()Ljava/io/File; 02-18 03:28:45.750: D/dalvikvm(925): VFY: replacing opcode 0x6e at 0x000b 02-18 03:28:47.130: W/WLClient(925): WLClient.createInstance in WLClient.java:225 :: You should pass a context that is assignable from the Activity class. WLClient instance may be used to start an activity. 02-18 03:28:47.460: D/dalvikvm(925): GC_FOR_ALLOC freed 311K, 12% free 2950K/3344K, paused 113ms, total 127ms 02-18 03:28:49.080: D/wl(925): WL. in WL.java:60 :: WL Constructor 02-18 03:28:49.120: D/wl.splashscreen(925): WLSplashScreen.show in WLSplashScreen.java:64 :: Showing Splash Screen 02-18 03:28:49.180: D/dalvikvm(925): GC_FOR_ALLOC freed 278K, 13% free 2969K/3404K, paused 27ms, total 28ms 02-18 03:28:49.180: I/dalvikvm-heap(925): Grow heap (frag case) to 3.522MB for 576016-byte allocation 02-18 03:28:49.230: D/dalvikvm(925): GC_FOR_ALLOC freed <1K, 11% free 3531K/3968K, paused 39ms, total 39ms 02-18 03:28:49.370: D/WLClient(925): WLClient$ActivityListener.onActivityStarted in WLClient.java:1476 :: on activity started com.AdapterApp.AdapterApp 02-18 03:28:49.630: I/Choreographer(925): Skipped 68 frames! The application may be doing too much work on its main thread. 02-18 03:28:49.850: D/WLClient(925): WLClient$ActivityListener.onActivityResumed in WLClient.java:1465 :: on activity resumed com.AdapterApp.AdapterApp . activity count = 1 02-18 03:28:50.040: I/Choreographer(925): Skipped 43 frames! The application may be doing too much work on its main thread. 02-18 03:28:50.160: D/gralloc_goldfish(925): Emulator without GPU emulation detected. 02-18 03:28:50.540: D/prepackagedAssetManager(925): PrepackagedAssetsManager.copyPrepackagedAssetsToLocalStorage in PrepackagedAssetsManager.java:71 :: New installation/upgrade detected, copying resources and saving new checksum 02-18 03:28:52.680: D/wl(925): WL.doPrepareAssetsWork in WL.java:293 :: no need to check web resource integrity 02-18 03:28:52.830: V/WebViewChromium(925): Binding Chromium to the background looper Looper (main, tid 1) {b3d09450} 02-18 03:28:52.840: I/chromium(925): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0 02-18 03:28:52.850: I/BrowserProcessMain(925): Initializing chromium process, renderers=0 02-18 03:28:53.620: W/chromium(925): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation 02-18 03:28:53.680: E/chromium(925): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found. 02-18 03:28:53.680: E/chromium(925): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed. 02-18 03:28:53.680: E/chromium(925): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found. 02-18 03:28:53.700: E/chromium(925): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed. 02-18 03:28:53.700: E/chromium(925): [ERROR:gpu_info_collector.cc(86)] gfx::GLSurface::InitializeOneOff() failed 02-18 03:28:53.960: D/dalvikvm(925): GC_FOR_ALLOC freed 358K, 11% free 3655K/4092K, paused 140ms, total 141ms 02-18 03:28:53.960: I/dalvikvm-heap(925): Grow heap (frag case) to 4.249MB for 635812-byte allocation 02-18 03:28:54.020: D/dalvikvm(925): GC_FOR_ALLOC freed <1K, 10% free 4276K/4716K, paused 54ms, total 54ms 02-18 03:28:54.320: D/CordovaWebView(925): CordovaWebView is running on device made by: unknown 02-18 03:28:54.360: I/dalvikvm(925): Could not find method android.webkit.CookieManager.setAcceptThirdPartyCookies, referenced from method com.worklight.androidgap.plugin.WLInitializationPlugin.initialize 02-18 03:28:54.360: W/dalvikvm(925): VFY: unable to resolve virtual method 509: Landroid/webkit/CookieManager;.setAcceptThirdPartyCookies (Landroid/webkit/WebView;Z)V 02-18 03:28:54.370: D/dalvikvm(925): VFY: replacing opcode 0x6e at 0x001a 02-18 03:28:54.680: I/Choreographer(925): Skipped 104 frames! The application may be doing too much work on its main thread. 02-18 03:28:57.480: D/JsMessageQueue(925): Set native->JS mode to OnlineEventsBridgeMode 02-18 03:28:59.250: D/dalvikvm(925): GC_FOR_ALLOC freed 411K, 11% free 4372K/4864K, paused 65ms, total 67ms 02-18 03:29:01.030: V/StatusBar(925): StatusBar: initialization 02-18 03:29:01.030: V/StatusBar(925): Executing action: _ready 02-18 03:29:01.040: W/CordovaPlugin(925): Attempted to send a second callback for ID: StatusBar1774144398 02-18 03:29:01.040: W/CordovaPlugin(925): Result was: "Invalid action" 02-18 03:29:01.550: D/FileUtils(925): Unrecognized extra filesystem identifier: files-external 02-18 03:29:01.550: D/FileUtils(925): Unrecognized extra filesystem identifier: sdcard 02-18 03:29:01.560: D/FileUtils(925): Unrecognized extra filesystem identifier: cache-external 02-18 03:29:01.610: D/CordovaNetworkManager(925): Connection Type: 3g 02-18 03:29:01.610: D/CordovaNetworkManager(925): Connection Extra Info: epc.tmobile.com 02-18 03:29:01.630: D/CordovaNetworkManager(925): Connection Type: 3g 02-18 03:29:01.630: D/CordovaNetworkManager(925): Connection Extra Info: epc.tmobile.com 02-18 03:29:01.740: I/chromium(925): [INFO:CONSOLE(309)] "Error in Success callbackId: App1774144399 : Error: Unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (309) 02-18 03:29:01.780: I/chromium(925): [INFO:CONSOLE(311)] "Uncaught Error: Unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (311) 02-18 03:29:01.930: W/PluginManager(925): THREAD WARNING: exec() call to WLApp.writeUserPref blocked the main thread for 26ms. Plugin should use CordovaInterface.getThreadPool(). 02-18 03:29:01.960: W/PluginManager(925): THREAD WARNING: exec() call to WLApp.writeUserPref blocked the main thread for 18ms. Plugin should use CordovaInterface.getThreadPool(). 02-18 03:29:02.020: D/JsMessageQueue(925): Set native->JS mode to null 02-18 03:29:02.620: D/JsMessageQueue(925): Set native->JS mode to OnlineEventsBridgeMode 02-18 03:29:06.660: V/StatusBar(925): Executing action: _ready 02-18 03:29:06.660: W/CordovaPlugin(925): Attempted to send a second callback for ID: StatusBar599974231 02-18 03:29:06.660: W/CordovaPlugin(925): Result was: "Invalid action" 02-18 03:29:06.750: D/CordovaNetworkManager(925): Connection Type: 3g 02-18 03:29:06.750: D/CordovaNetworkManager(925): Connection Extra Info: epc.tmobile.com 02-18 03:29:06.780: I/chromium(925): [INFO:CONSOLE(309)] "Error in Success callbackId: App599974232 : Error: Unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (309) 02-18 03:29:06.860: I/chromium(925): [INFO:CONSOLE(311)] "Uncaught Error: Unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (311) 02-18 03:29:07.430: E/NONE(925): Uncaught Exception: Uncaught Error: Unknown event action undefined at (compiled_code):311 02-18 03:29:07.450: D/NONE(925): ondeviceready event dispatched 02-18 03:29:07.570: W/PluginManager(925): THREAD WARNING: exec() call to Globalization.getLocaleName blocked the main thread for 154ms. Plugin should use CordovaInterface.getThreadPool(). 02-18 03:29:07.690: D/NONE(925): wlclient init started 02-18 03:29:07.750: D/NONE(925): Read cookies: null 02-18 03:29:07.890: D/NONE(925): CookieMgr read cookies: {} 02-18 03:29:08.010: W/NONE(925): Note that if your application targets Android 3.0 (API level 11) or higher, WL.OptionsMenu might have no effect, depending on the device. 02-18 03:29:08.100: D/dalvikvm(925): GC_FOR_ALLOC freed 531K, 13% free 4376K/4984K, paused 32ms, total 33ms 02-18 03:29:08.110: D/NONE(925): addDeviceIDHeader deviceIDSuccessCallback 02-18 03:29:08.160: D/com.worklight.androidgap.plugin.WLNativeXHRPlugin(925): WLNativeXHRPlugin.execute in WLNativeXHRPlugin.java:52 :: execute 02-18 03:29:08.180: D/com.worklight.androidgap.plugin.WLNativeXHRPlugin(925): WLNativeXHRPlugin.doAddGlobalHeader in WLNativeXHRPlugin.java:100 :: doAddGlobalHeader 02-18 03:29:08.240: D/NONE(925): connectOnStartup finalizeInit 02-18 03:29:08.330: D/NONE(925): before: initOptions.onSuccess 02-18 03:29:08.460: D/wl.splashscreen(925): WLSplashScreen.hide in WLSplashScreen.java:71 :: Hiding Splash Screen 02-18 03:29:08.480: I/dalvikvm(925): Could not find method com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable, referenced from method com.worklight.wlclient.push.common.GCMClientFactory.useGooglePlayServices 02-18 03:29:08.540: W/dalvikvm(925): VFY: unable to resolve static method 651: Lcom/google/android/gms/common/GooglePlayServicesUtil;.isGooglePlayServicesAvailable (Landroid/content/Context;)I 02-18 03:29:08.540: D/dalvikvm(925): VFY: replacing opcode 0x71 at 0x0006 02-18 03:29:08.600: D/GCMClientFactory(925): GCMClientFactory.useGooglePlayServices in GCMClientFactory.java:42 :: Google Play Services is not used because the play services library is not found. So using the default GCM helper implementation. 02-18 03:29:08.610: W/PluginManager(925): THREAD WARNING: exec() call to Push.notifyInitComplete blocked the main thread for 17ms. Plugin should use CordovaInterface.getThreadPool(). 02-18 03:29:08.690: D/GCMClientFactory(925): GCMClientFactory.getInstance in GCMClientFactory.java:28 :: Using GCMHelperClient 02-18 03:29:08.760: D/NONE(925): after: initOptions.onSuccess 02-18 03:29:08.770: D/NONE(925): added onPause and onResume event handlers 02-18 03:29:08.790: D/NONE(925): wlclient init success 02-17 03:32:33.982: W/PluginManager(925): THREAD WARNING: exec() call to LoggerPlugin.log blocked the main thread for 85ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:34.072: I/Choreographer(925): Skipped 37 frames! The application may be doing too much work on its main thread. 02-17 03:32:34.362: D/NONE(925): establishSSLClientAuth 02-17 03:32:34.382: W/PluginManager(925): THREAD WARNING: exec() call to UserAuth.init blocked the main thread for 28ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:34.462: I/Choreographer(925): Skipped 34 frames! The application may be doing too much work on its main thread. 02-17 03:32:34.762: I/Choreographer(925): Skipped 31 frames! The application may be doing too much work on its main thread. 02-17 03:32:34.782: W/PluginManager(925): THREAD WARNING: exec() call to UserAuth.isCertificateExists blocked the main thread for 45ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:34.962: D/wl.userAuthManager(925): WLUserAuthManager.doesValidCertificateExist in WLUserAuthManager.java:129 :: doesValidCertificateExists = false 02-17 03:32:35.022: W/PluginManager(925): THREAD WARNING: exec() call to LoggerPlugin.log blocked the main thread for 52ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:35.222: D/dalvikvm(925): GC_FOR_ALLOC freed 511K, 12% free 4397K/4984K, paused 99ms, total 111ms 02-17 03:32:35.242: D/NONE(925): establishSSLClientAuth isCertificateExists: false 02-17 03:32:35.422: D/NONE(925): Request [/apps/services/api/AdapterApp/android/query] 02-17 03:32:35.562: D/WL_DIRECT_UPDATE_MANAGER(925): skinLoaderChecksum does not exists. 02-17 03:32:35.592: D/NONE(925): Application details header: {"applicationDetails":{"platformVersion":"7.1.0.0","nativeVersion":"3641188782","skinName":"default","skinChecksum":1364593095}} 02-17 03:32:35.732: W/PluginManager(925): THREAD WARNING: exec() call to WLAuthorizationManagerPlugin.getClientInstanceIdHeader blocked the main thread for 99ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:36.362: W/PluginManager(925): THREAD WARNING: exec() call to WLAuthorizationManagerPlugin.getWlSignedClientId blocked the main thread for 567ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:36.502: D/WLNativeXHR(925): Constructing 02-17 03:32:36.652: D/WLNativeXHR(925): open method POST url /apps/services/api/AdapterApp/android/query 02-17 03:32:36.732: D/WLNativeXHR(925): setRequestHeader name X-Requested-With value XMLHttpRequest 02-17 03:32:36.782: D/WLNativeXHR(925): setRequestHeader name Accept value text/javascript, text/html, application/xml, text/xml, / 02-17 03:32:36.792: D/WLNativeXHR(925): setRequestHeader name Accept-Language value en-US 02-17 03:32:36.802: W/PluginManager(925): THREAD WARNING: exec() call to LoggerPlugin.log blocked the main thread for 21ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:36.842: D/WLNativeXHR(925): setRequestHeader name Content-type value application/x-www-form-urlencoded; charset=UTF-8 02-17 03:32:36.872: W/PluginManager(925): THREAD WARNING: exec() call to LoggerPlugin.log blocked the main thread for 41ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:36.952: D/WLNativeXHR(925): setRequestHeader name x-wl-app-version value 1.0 02-17 03:32:37.032: D/WLNativeXHR(925): setRequestHeader name x-wl-app-details value {"applicationDetails":{"platformVersion":"7.1.0.0","nativeVersion":"3641188782","skinName":"default","skinChecksum":1364593095}} 02-17 03:32:37.102: W/PluginManager(925): THREAD WARNING: exec() call to LoggerPlugin.log blocked the main thread for 23ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:37.202: D/dalvikvm(925): GC_FOR_ALLOC freed 1083K, 24% free 3855K/5016K, paused 50ms, total 52ms 02-17 03:32:37.242: D/WLNativeXHR(925): setRequestHeader name x-wl-clientlog-deviceId value 9a6a2a818ae5015f 02-17 03:32:37.302: W/PluginManager(925): THREAD WARNING: exec() call to LoggerPlugin.log blocked the main thread for 21ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:37.362: D/WLNativeXHR(925): setRequestHeader name x-wl-clientlog-appname value AdapterApp 02-17 03:32:37.412: D/WLNativeXHR(925): setRequestHeader name x-wl-clientlog-appversion value 1.0 02-17 03:32:37.462: D/WLNativeXHR(925): setRequestHeader name x-wl-clientlog-osversion value 4.4.2 02-17 03:32:37.492: W/PluginManager(925): THREAD WARNING: exec() call to WLNativeXHRPlugin.send blocked the main thread for 39ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:32:37.562: D/WLNativeXHR(925): setRequestHeader name x-wl-clientlog-env value android 02-17 03:32:37.592: D/WLNativeXHR(925): setRequestHeader name x-wl-clientlog-model value sdk 02-17 03:32:37.682: D/WLNativeXHR(925): setRequestHeader name X-WL-ClientId value f225ccfd602d6dc7c10abf19b0448000dab6f754 02-17 03:32:37.692: D/WLNativeXHR(925): setRequestHeader name X-WL-Session value ed65ba9a-704d-4a4e-99db-6dbdc7465a8e 02-17 03:32:37.732: D/WLNativeXHR(925): setRequestHeader name X-WL-S-ClientId value eyJqcGsiOnsiYWxnIjoiUlNBIiwiZXhwIjoiQVFBQiIsIm1vZCI6IkFLaG82TEZreWdsT2FSVldzRTNCVThFZGFCb2t1YjVUN2F1M085OW1UWV9LV3VxckZnelAzc1l2QkZJUTVjaXdpZGNvcEsxX1g2NlJySDhid243VXhsYz0ifSwiYWxnIjoiUlMyNTYifQ==.eyJjbGllbnRJZCI6ImYyMjVjY2ZkNjAyZDZkYzdjMTBhYmYxOWIwNDQ4MDAwZGFiNmY3NTQifQ==.Kk9M6U0zsaIsbG8KY52TSzQOngL5o8I8oqN49U-QZc4bvkEsSkPENRHHVbPztU8QmGlHJVDo8xbtzEIQZ0a5lw== 02-17 03:32:37.742: D/WLNativeXHR(925): send 02-17 03:32:37.782: D/com.worklight.androidgap.plugin.WLNativeXHRPlugin(925): WLNativeXHRPlugin.execute in WLNativeXHRPlugin.java:52 :: execute 02-17 03:32:37.832: D/com.worklight.androidgap.plugin.WLNativeXHRPlugin(925): WLNativeXHRPlugin.doSend in WLNativeXHRPlugin.java:72 :: doSend 02-17 03:32:37.912: D/HttpPostRequestSender(925): WLHybridRequestSender.run in WLHybridRequestSender.java:42 :: Sending request http://Masterkevin-PC:10080/AdapterProject/apps/services/api/AdapterApp/android/query 02-17 03:32:38.362: D/dalvikvm(925): GC_FOR_ALLOC freed 499K, 23% free 3868K/5016K, paused 39ms, total 41ms 02-17 03:32:38.412: E/com.worklight.androidgap.plugin.WLNativeXHRPlugin(925): WLNativeXHRPlugin$NativeXHRPostListener.onException in WLNativeXHRPlugin.java:177 :: onException 02-17 03:32:38.462: D/com.worklight.androidgap.plugin.WLNativeXHRPlugin(925): WLNativeXHRPlugin$NativeXHRPostListener.buildResponseJSON in WLNativeXHRPlugin.java:199 :: buildResultJSON 02-17 03:32:38.492: D/WLNativeXHR(925): callback {"headers":{},"responseText":"","statusText":"Unexpected errorCode occurred. Please try again.","wlFailureStatus":"UNEXPECTED_ERROR","status":0} 02-17 03:32:38.572: E/NONE(925): [/apps/services/api/AdapterApp/android/query] Host is not responsive. Try to manually access the URL through the android emulator browser to verify connectivity. 02-17 03:32:38.982: I/Choreographer(925): Skipped 36 frames! The application may be doing too much work on its main thread. 02-17 03:33:17.552: D/dalvikvm(925): GC_FOR_ALLOC freed 212K, 17% free 4167K/5016K, paused 71ms, total 73ms 02-17 03:33:17.712: D/WLClient(925): WLClient$ActivityListener.onActivityPaused in WLClient.java:1458 :: on activity paused com.AdapterApp.AdapterApp . activity count = 0 02-17 03:33:18.582: I/Choreographer(925): Skipped 128 frames! The application may be doing too much work on its main thread. 02-17 03:33:18.632: W/PluginManager(925): THREAD WARNING: exec() call to LoggerPlugin.log blocked the main thread for 227ms. Plugin should use CordovaInterface.getThreadPool(). 02-17 03:33:18.672: W/IInputConnectionWrapper(925): showStatusIcon on inactive InputConnection 02-17 03:33:18.712: D/WLClient(925): WLClient$ActivityListener.onActivityStopped in WLClient.java:1482 :: on activity stopped com.AdapterApp.AdapterApp 02-17 03:33:18.722: D/WLClient(925): WLClient$ActivityListener.onActivityDestroyed in WLClient.java:1450 :: on activity destroyed com.AdapterApp.AdapterApp 02-17 03:33:18.742: I/chromium(925): [INFO:CONSOLE(1)] "exception firing destroy event from native", source: file:///android_asset/www/default/index.html (1) 02-17 03:33:18.832: D/wl.splashscreen(925): WLSplashScreen.hide in WLSplashScreen.java:71 :: Hiding Splash Screen 02-17 03:33:18.872: W/GCMHelperClient(925): GCMHelperClient.unregisterReceivers in GCMHelperClient.java:139 :: unregister:Receiver not registered: null 02-17 03:33:18.932: W/GCMHelperClient(925): GCMHelperClient.unregisterReceivers in GCMHelperClient.java:145 :: unregister:Receiver not registered: null 02-17 03:33:18.962: W/GCMHelperClient(925): GCMHelperClient.unregisterReceivers in GCMHelperClient.java:151 :: unregister:Receiver not registered: null 02-17 03:33:18.982: D/GCMHelperUtil(925): GCMHelperUtil.getRegistrationId in GCMHelperUtil.java:75 :: Registration not found 02-17 03:33:19.002: D/push(925): Push.unregisterReceivers in Push.java:229 :: unregisterReceivers:Receiver not registered: null 02-17 03:33:19.062: D/NONE(925): Flush called

1
Have you tried invoking this procedure directly from Eclipse (in your development environment)? If so, what is returned? The information you've posted doesn't have any info about exactly what failed, but I can say that I was able to query the Geocoding service manually the same way as the adapter should be doing, and it worked, so we can be reasonably confident that the API hasn't changed. - patbarron
when invoking this procedure directly from Eclipse (in the development environment), the response is returned in the browser and it works successfully. i get the following error: 02-09 00:30:58.672: E/NONE(1155): Uncaught Exception: Uncaught Error: Unknown event action undefined at (compiled_code):311 and the app is not running on the emulator. - Gunesh.John
I think this is the errors: 02-09 04:05:21.924: D/NONE(1435): Client registration failed with error: {"responseHeaders":{},"status":500,"responseText":"","invocationContext":null} 02-09 04:05:22.074: E/NONE(1435): [/apps/services/api/AdapterApp/android/query] failure. state: 500, response: undefined - Gunesh.John
I have found the solution. we need to change hostname, then it works on the android emulator. However, when deploying the application to be ran on a real android device. i got the first error because when i changed the hostname, i did set it to the ip of my pc. Can someone tell me what to do please? Thanks - Gunesh.John
I am assuming the hostname you changed is the publicWorkLightHostname value in worklight.properties? When you run the app on a real device, does the device have connectivity to your PC (where the development server is running) - is it on the same network, or at least a network where it can reach your PC's IP address? If so, could firewall rules be stopping the traffic from your device from reaching the development server? - patbarron

1 Answers

0
votes

From the log:

istener.buildResponseJSON in WLNativeXHRPlugin.java:199 :: buildResultJSON 02-17 03:32:38.492: D/WLNativeXHR(925): callback {"headers":{},"responseText":"","statusText":"Unexpected errorCode occurred. Please try again.","wlFailureStatus":"UNEXPECTED_ERROR","status":0} 02-17 03:32:38.572: E/NONE(925): [/apps/services/api/AdapterApp/android/query] Host is not responsive

You need to set the IP address to your public one.
This can be done in Run As -> Build Settings and Remote Target

There you need to supply the public IP address of the machine that hosts the MobileFirst Server.