Build -
4 min read
Apr 30, 2019
Realtime Live Chat Application in JavaScript in Only 10 Line…
Learn the basics of building chat with this simple JavaScrip…
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
While you’re in there, you’ll also need to update the Google Maps API key you set up earlier:
<meta-data android:name="com.google.android.geo.API_KEY" android:value="YOUR_MAPS_KEY"/>
We’ve taken the approach of encapsulating common settings into a Constants.java file – for example, the PubNub publish and subscribe keys mentioned earlier in this tutorial.
public class Constants { public static final String PUBNUB_PUBLISH_KEY = "YOUR_PUB_KEY"; public static final String PUBNUB_SUBSCRIBE_KEY = "YOUR_SUB_KEY"; ... }
To run the code, you just need to push the green “play” button in the IDE. That will bring up the Android device chooser so you can choose where to run the app. We typically run our apps using emulation first since it’s quicker.
Once you get the hang of that, it’s easy to connect an Android device via USB for live debugging. This is especially handy for testing live location tracking, which isn’t as practical in the emulator.
With that, we now have our app set up. In Part Two, we’ll implement live map markers, which identify where a device is located on a map.
Learn the basics of building chat with this simple JavaScrip…
How to setup and send push notifications for iOS (APNS) and …
How to build a leaderboard for multiplayer games that update…