Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8226675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T15:51:23+00:00 2026-06-07T15:51:23+00:00

I am able to use a NowJS chat when accessing a file with the

  • 0

I am able to use a NowJS chat when accessing a file with the android browser, but when the same code is executed within phonegap the messages don’t get received or sent.

Has anybody been able to successfully use nowJS or sockets with phonegap/cordova?

Code working on web browsers, FF, Chrome, and android native browser, however not phonegap

$(document).ready(function(){
        now.receiveMessage = function(id, name, message, timestamp){
            $("#messages").append("<br>" + id + ' ' + name + ": " + message + ' ' + timestamp);
        };

        // Send message to people in the same group
        $("#send-button").click(function(){
            now.distributeMessage(room, $("#text-input").val());
            $("#text-input").val("");
        });

        now.name = 'Guest '+Math.floor(Math.random() * 1000 % 5 + 2);

        // on establishing 'now' connection, set server room and allow message sending
        now.ready(function(){
        room = location.hash.replace('#', '');

            if (!room) {
            alert("Please specify a room");
            throw "";
            }

            now.changeRoom(room);

            // Connection established and room set; allow user to start sending messages
            $("#send-button").removeAttr('disabled');
        });
    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T15:51:25+00:00Added an answer on June 7, 2026 at 3:51 pm

    It may be that the fallback mechanism in Now.js isn’t working in the WebView when running in PhoneGap. If they use Flash Fallback then you need to enable plugins. It looks like this is going to be enabled by default very soon:
    https://github.com/apache/incubator-cordova-android/pull/18

    I recently created a Pusher for PhoneGap on Android starter project and instead of enabling plugins and relying on Flash I instead exposed a WebSocket object running in Java to the WebView JavaScript runtime. I really like this approach as it removes the Flash problem altogether. Maybe this is something that you could do in your android app?

    You can see starter project which includes all the necessary code to expose the WebSocket object to the WebView JS runtime here (just replace the pusher.min.js include with the now.js one):

    • https://github.com/pusher/pusher-phonegap-android

    And information on the PhoneGap WebSocket Android support via the README:
    https://github.com/pusher/pusher-phonegap-android#native-websocket-support

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I like being able to use the (Java) Code Formatter in Eclipse, but Eclipse
I was able to use the code in this answer to access a value
I want to be able to use Python to open a .csv file like
I was able to use where clause like the first one. But I get
I am able to use WinForms controls, but not an entire form: var foo
I am able to use tintColor to change the color of my NavBar, but
I was able to use How To Get Redirect URL In PHP but now
Should I be able to use the same AudioBufferSourceNode to play a sound multiple
I am able to use: C:\Program Files (x86)\Java>javac -classpath mail.jar myFile.java to compile,but when
I am able to use map and sum to achieve this functionality, but how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.