GithubHelp home page GithubHelp logo

pusher-phonegap-android's Introduction

Pusher PhoneGap for Android

This is a sample project that demonstrates how to use the Pusher JavaScript library within PhoneGap on Android.

Changelog

  • 2.0-beta.1 - Removed Java WebSocket wrapper as pusher-js 2.* now provides a HTTP-based fallback. Awaiting 2.0.5 full release before moving from beta.
  • 1.0 - Used Java WebSocket wrapper with pusher-js 1.* to provide WebSocket support

Prerequisites

See step 2 of the Getting Started with Android guide from the PhoneGap site.

Getting started

  1. git clone [email protected]:pusher/pusher-phonegap-android.git (this repo).
  2. cd pusher-phonegap-android
  3. See Prerequisites above. Don't move on to step 3 in the PhoneGap guide.
  4. Open Eclipse
  5. In Eclipse:
    1. Eclipse menu: File -> Import
    2. Import Dialog: General -> Existing Projects into Workspace
    3. Select the pusher-phonegap-android folder. Click Finish.
  6. At this point you may get a few errors. To resolve
    1. Right click on the pusher-phonegap-android project and select Properties
    2. Select Android in the left menu
    3. Select a Project Build Target. I chose Android 4.0.3. If you don't have any targets then it's likely your Android SDK isn't linked in properly. You can add this within the project properties and Java Build Path -> Libraries and add from the location you downloaded and extracted the Android SDK to.
  7. When you've no errors you can run the sample application:
    1. Click the Run icon
    2. In the Run As dialog select Android Application.
    3. The emulator will launch.
    4. Switch to the Debug Perspective in Eclipse and look at the LogCat panel. You should see a tonne of information streaming in. Eventually you'll start to see Pusher related debug.
    5. The emulator will eventually load the sample application and you'll see:
      1. A connection status of connected which indicates that the application are connected to Pusher
      2. A subscription status of subscribed which indicates a channel has successfully been subscribed to.

Note I've found emulators, like Eclipse, to be a bit temperamental. But, persevere and keep trying to run the application and eventually things will work as expected.

Project notes

Links

Android 2.3 Emulator Crashes

There is a known bug with the Javascript to Java Bridge in 2.3 emulators which means the application crashes. This bug has been open for a long time so it's best to use another version of Android with the emulator for development.

If you see an error and the information contains:

JNI WARNING: jarray 0x40629bb0 points to non-array object (Ljava/lang/String;)

Then that's this issue! Use a different version of Android with the emulator.

pusher-phonegap-android's People

Contributors

leggetter avatar marknadig avatar rdpfeffer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.