everlive.js on android 2.3.6

9 posts, 0 answers
  1. Kevin
    Kevin avatar
    6 posts
    Member since:
    Jun 2015

    Posted 15 Jun 2015 Link to this post

    Hi,

    I am new to telerik. I built a simple app which responds to a push notification.

    The app works in the simulator. It works as an "App Package" on my windows 8 phone.

    I have an old android handset running android 2.3.6 (samsung galaxy GT S5363). The app does not run on this phone (as "App Package").

    The problem seems to be that the everlive.all.js does not load. The global window.Everlive is undefined.

    I tried putting alerts into the everlive.all.js file. These display on the windows phone but not on the android phone. My guess is that there is a syntax problem in the everlive.all.js.

    I put alerts before and after the include in the "index.html". These alerts do display.

    Can anyone advise me as to how to proceed. 

    Thanks in advance,

     

    Kevin

     

     

     

  2. Kevin
    Kevin avatar
    6 posts
    Member since:
    Jun 2015

    Posted 16 Jun 2015 Link to this post

    For the record, I installed the App on a table running android version 4.4.4, and it works fine.
  3. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 17 Jun 2015 Link to this post

    Hi Kevin,

    Indeed, I experimented a bit with an Android 2.3.6 device and managed to reproduce similar behavior. Basically, this appears to be connected to timeout errors in the WebView. This is easily observable if you connect your device to the Android Device Monitor.

    In order to fix this behavior on my side I used the following preference in the Android Config.xml file in my AppBuilder project. 
    <preference name="loadUrlTimeoutValue" value="60000" />

    Also, make sure that you are loading the Everlive JS SDK from a local resource and not from a CDN.

    Also, in order to handle push notifications in the background of the app, you need to modify this line of code in the Telerik Push Notifications plugin and import the plugin manually from the GitHub-exported ZIP arhcive.

    To illustrate the working behavior, I prepared a simple example which you can clone in AppBuilder from here.

    Prior to testing make sure to populate the API key and the Google Project Number in the app and deploy as an app package to a device.


    Testing details:

    Samsung Nexus S
    Backend Services JS SDK 1.3.1
    Push Notifications plugin 2.5.7
    Cordova 3.5.1


    Let me know if this helps.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
  4. Kevin
    Kevin avatar
    6 posts
    Member since:
    Jun 2015

    Posted 17 Jun 2015 Link to this post

    Hi Anton,

    Unfortunately, the sample code you provided exhibits the same problem, i.e. that Everlive is undefined.

    The code worked correctly on the on Android 4.4 but fails on the Andoid 2 device.

    I added an exception handler around the Everlive initialisation, and get the error that Everlive is undefined. I am guessing that this is that the javascript import is in error, as if there is an exception in the everlive.js file.

    I will try deploying the app on iOS now which is also giving me a problem, though that is most likely configuration problems.

    Kevin

     

     

     

  5. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 19 Jun 2015 Link to this post

    Hello Kevin,

    Thank you for trying this out on your side.

    The error I reproduced was deriving from a timeout in the WebView loading (the Cordova apps runtime environment). Loading the WebView resulted in a timeout on the device (most probably because the device is performing slowly). Thus calling any JavaScript object would be undefined, because the environment within which it is running is not available. This would happen also with other JavaScript libraries as well. Adding the suggested timeout fixed the issue on a Nexus S device with 2.3.6 version of Android on my side. Unfortunately, I am not able to test with the same device you are using. 

    Could you please confirm that you deployed the sample project to your device as an app package (APK file)? Also. you may consider trying setting up the timeout value to a higher number (the value displayed is in milliseconds) then build the app package and deploy it again.

    For further testing on your side, may I suggest that you install the Android Device Monitor. This is a very useful tool that will allow you to examine the behavior of your device when running your applications on it and any errors occurring during the application life-cycle. Please, observe the LogCat errors which would be displayed in red. Attached is a screenshot of the result I received when running the application before running the fix and the Timeout issue which was preventing any application logic to run correctly.

    Best regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
  6. Kevin
    Kevin avatar
    6 posts
    Member since:
    Jun 2015

    Posted 01 Jul 2015 in reply to Anton Dobrev Link to this post

    >> Could you please confirm that you deployed the sample project to your
    >> device as an app package (APK file)? Also. you may consider trying
    >> setting up the timeout value to a higher number (the value displayed is
    >> in milliseconds) then build the app package and deploy it again.

    I deployed the app as an apk file, directly from the telerik site. I used a qrcode reader to get to the download link. The install was straight forward. The only change I made was to add the exception handler mentioned previously.

     I modified loadUrlTimeoutValue to 600000, rebuilt and deleted/reinstalled the app. This made no difference. Please note that there is no delay in loading. It does not seem like a request is waiting and then timing out.

    <preference name="loadUrlTimeoutValue" value="600000" />

    I will try go get the android device monitor working.

     




    For further testing on your side, may I suggest that you install the Android Device Monitor.
    This is a very useful tool that will allow you to examine the behavior
    of your device when running your applications on it and any errors
    occurring during the application life-cycle. Please, observe the LogCat
    errors which would be displayed in red. Attached is a screenshot of the
    result I received when running the application before running the fix
    and the Timeout issue which was preventing any application logic to run
    correctly.

  7. Kevin
    Kevin avatar
    6 posts
    Member since:
    Jun 2015

    Posted 01 Jul 2015 in reply to Kevin Link to this post

    I got the Android Device Monitor working. This reports an error in everlive.js at line 18556, I assume because "catch" is a reserved word.

    line 18556: .catch(reject);

    I will do some hacks on the source file to rename the function catch and see if the code now loads.

  8. Kevin
    Kevin avatar
    6 posts
    Member since:
    Jun 2015

    Posted 01 Jul 2015 in reply to Kevin Link to this post

    I modified the source to replace catch() with _catch(). This seems to allow the execution to continue, but it is running into another error that the bind() function is undefined.

    Function.prototype.bind() is undefined on this platform.

    I added bind using this polyfill.

     https://gist.github.com/dsingleton/1312328

    Now my app seems to work on Android 2.3.6.

    Regards,

     Kevin

     

     

  9. Anton Dobrev
    Admin
    Anton Dobrev avatar
    539 posts

    Posted 02 Jul 2015 Link to this post

    Hi Kevin,

    Thanks for sharing this.

    Let me know if further questions arise.

    Regards,
    Anton Dobrev
    Telerik
     
    Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
     
Back to Top