To download and start using the SDK, you first need to register your Android application in Dashboard. See Managing Non-Titanium Client Applications in Dashboard for details on registering a new application. After you register the application, a service key is generated that associates your application with all the Platform services. Appcelerator Dashboard also provides full instructions for enabling all Platform Services in your application. This guide will deal specifically with enabling and using MBS in an Android application.
All Cloud API calls must be made on the UI (main) thread, and callbacks are executed on the UI thread.
- Configure push services for your application.
- Add Google Play services as a dependency to your project and update the project's
AndroidManifest.xmlfile. See the Android Project Requirements section below.
- Retrieve the device token and subscribe to push notifications with MBS. See the Subscribe to push notifications section below.
Android Project Requirements for using APSCloud Push
- In Eclipse, select File > Import > General > Existing Projects into Workspace and click Browse.
- Navigate to the
appcelerator-sdk-android-<VERSION>/examples/APSCloudPushExamplefolder and click Open.
- Click Finish to import the project.
- Add the Google Play services to your project (see Android Project Requirements for instructions).
In MainActivity.java, locate the following line and replace << YOUR APP KEY >> with the application key generated by Dashboard (see instructions):
Table Cell (td) Code Block language js
String appKey = "<< YOUR APP KEY >>";
- Run the application on an Android device or emulator.