Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated link for managing cloud user accounts

...

  1. In Eclipse, create a new Android project with a Blank Activity.
  2. Unpack the appcelerator-sdk-android-<VERSION>.zip file.
  3. Copy the  appcelerator-sdk-android-<VERSION>.jar  file to the  libs  folder of your Android project (if you wish to use Maven or Gradle, see "Building the Application" below for setup instructions).
  4. Modify the project's  AndroidManifest.xml  file to include the ACCESS_NETWORK_STATE ACCESS_WIFI_STATE , GET_TASKS INTERNET READ_LOGS and WRITER_EXTERNAL_STORAGE user permissions and declare the  com.appcelerator.aps.AnalyticsService  as a Service class, which allows the APS library to send analytic events to the APS servers while the application is in the background: 

    Code Block
    titleAndroidManifest.xml
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.appcelerator.sample"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <!-- Add these permissions to enable Analytics, Cloud and Performance -->
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
        <uses-permission android:name="android.permission.GET_TASKS" />
        <uses-permission android:name="android.permission.READ_LOGS"/>
        <application>
            <activity>
                ...
            </activity>
     
            <!-- Add this service to enable Analytics -->
            <service android:name="com.appcelerator.aps.APSAnalyticsService"
                android:exported="false" />
        </application>
    </manifest>
  5. Add the following import statement to the main Activity of the project: 

    Code Block
    titleMainActivity.java
    import com.appcelerator.aps.APSServiceManager;
  6. In the main Activity's  onCreate()  method, add the following method call to enable the APS services.

    Code Block
    titleMainActivity.java
    languagejava
    APSServiceManager.getInstance().enable(getApplicationContext(), "APP_KEY");

    The Android application is now ready to make method calls using the APS SDK APIs.

...

Multiexcerpt
MultiExcerptNametesting

Testing the Tutorial Sample

Before testing the sample, you need to create user accounts for the application to query.  To create Cloud user accounts:

  1. Log in to Appcelerator Dashboard.
  2. In Dashboard, select your application from the APIs menu in the upper-left corner.
  3. In the left navigation bar, click Manage Data.
  4. Click Users, then the Create User button.
  5. In the Username field enter the user's username.
  6. In the Password field enter the new user's password (four-character minimum).
  7. Click Save Changes.
Info

To create a Cloud user account, you only need a username or e-mail address, and a password.

For more information about managing Cloud user accounts, see Managing UsersOrganizations.

After you have created a few Cloud user accounts, build the sample and launch it on either a device or emulator.

Once the application launches:

  1. Click on the Picker/Spinner.  You should see a list of all the Cloud user accounts you added.
  2. Select a user account from the Picker/Spinner and enter that user's password.  Click the Button.  In the log output, you should see an info log that login command was successful or not.
  3. Go back to the Appcelerator Dashboard.
  4. In Dashboard, select your application from the Apps menu in the upper-left corner.
  5. In the left navbar, click Performance, then Handled Exceptions. You should see the "Something happened..." exception in the list.
  6. In the left navbar, click Search by User.  Enter the username of the account that successfully logged in.  Click the username.  You should see a crash report for the user. 
  7. In the left navbar, select Analytics.
  8. In the Real Time view, you should see at least one active session.
  9. In the left navbar, click Events.  You should see the "sample.feature.login" feature event.

...