Pusher PhoneGap for Android
- 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
See step 2 of the Getting Started with Android guide from the PhoneGap site.
git clone firstname.lastname@example.org:pusher/pusher-phonegap-android.git(this repo).
- See Prerequisites above. Don't move on to step 3 in the PhoneGap guide.
- Open Eclipse
- In Eclipse:
- Eclipse menu: File -> Import
- Import Dialog: General -> Existing Projects into Workspace
- Select the pusher-phonegap-android folder. Click Finish.
- At this point you may get a few errors. To resolve
- Right click on the pusher-phonegap-android project and select Properties
- Select Android in the left menu
- 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.
- When you've no errors you can run the sample application:
- Click the Run icon
- In the Run As dialog select Android Application.
- The emulator will launch.
- 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.
- The emulator will eventually load the sample application and you'll see:
- A connection status of connected which indicates that the application are connected to Pusher
- 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.
Android 2.3 Emulator Crashes
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.