Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
UNDER CONSTRUCTION
This document explains how to download the Appoxee Android SDK and integrate it with your application code.
The integration consists of the following steps:
  1. Step 1 - Enable Push Notifications for your Application - Follow the instructions in Appoxee's Android Push Notifications Guide.
  2. Step 2 - Download the Appoxee Android SDK- Go to the Android SDK Downloads page and download the Appoxee Android SDK.
  3. Step 3- Add the Appoxee Android SDK as an Eclipse Project - Extract the SDK to Eclipse and create a new Android project that uses Appoxee resources (see Adding the Appoxee Android SDK to Eclipse).
  4. Step 4 - Integration - Add the Appoxee code to your Android application (see ).
  1.  

Step 4 - Integration

This section uses the following typographic conventions:

  • Regular text = existing code you should already have in your project by default.
  • Bold text = new code you should copy & paste / add to your application.
  • Green text = comments about the function, what it does and what you can do with it including special notices. We recommend you read them thoroughly as well.
  • Blue text - comments within XML files (i.e. AndroidManifest.xml)

...

public AppoxeeConfiguration()
{
//the sdk key and secret key can be found in your Appoxee application setting
//"Application Appoxee SDK Key" from your Application Settings 
SetAppSDKKey("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
//"Application Appoxee Secret Key" from your Application Settings 
SetAppSecretKey("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
//If your app have an inbox, use true, if not, use false 
SetAppoxeeInboxEnable(true);
//This is the activity which will be launched after your receive push notification or after the inbox is closed.
SetAppDefaultActivityClass("com.myApp.DefaultActivity");
}

...

public class MyApplication extends Application 
{
@Override
public void onCreate()
{
super.onCreate();
Appoxee.Setup(this, new AppoxeeConfiguration());
}
}

If prompted with an error, add this import command to enable Appoxee SDK usage:

import com.appoxee.Appoxee

...

NOTE
Step b is not required if you are targeting your application to android version 4.1 or above (i.e. minSdkVersion 16). Please proceed to step c.

...

You need to replace com.appoxee.example with the package name of your app as defined by the manifest tag, otherwise it will not work.
 

...

<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:allowClearUserData="true"
android:enabled="true" android:name="MyApplication"/>

...

<service android:name="com.appoxee.gcm.GCMIntentService"/>
<receiver android:name="com.appoxee.gcm.GCMBroadcastReceiver"

android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->

<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.appoxee.example" />
</intent-filter>
<!-- Receive the registration id -->

<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.appoxee.example" />
</intent-filter>
</receiver>
NOTE
If you are using Appoxee's SDK as a Push Only solution (without using the Inbox) this completes the integration procedure within the AndroidManifest.xml file. Please continue to step 4 to complete the rest of the integration by adding your java code.

...

<activity android:name="com.appoxee.Inbox"/>
<activity android:name="com.appoxee.MoreApps"/>
<activity android:name="com.appoxee.Feedback"/>
<activity android:name ="com.appoxee.InboxMessage"/>

 

NOTE
The Inbox feature guarantees your ability to engage the user with rich messages (note that the Inbox cannot be disabled by users, as opposed to Push Notifications) and gives you the option to access features such as Feedback and More Apps . The Inbox must be used in your application's code in order to show it and utilise its features (see Android SDK integration Instructions Step 5).

...

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

...

android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->

<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.appoxee.example" />
</intent-filter>
<!-- Receive the registration id -->

<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.appoxee.example" />
</intent-filter>

...

  1. The application needs to notify the Appoxee server when it starts/ends in order to allow the analytics functionality to work. The functions Appoxee.onStart() and Appoxee.onStop() needs to be called from the appropriate places (most likely from within your main activity):
    //Your Main Activity Code... 
    {
    ...
    @Override
    public void onResume() 
    {
    super.onResume();
    Appoxee.onStart();
    }
    @Override
    public void onPause() 
    {
    super.onPause();
    Appoxee.onStop();
    }
  2. If you enabled the Appoxee Inbox feature, it can be opened from any activity. In the example code below it will be opened from the main activity layout using openInbox():
    public void openInbox(View view)

    Intent intent = new Intent(this, Inbox.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    this.startActivity(intent); 
    }
     
  3. It is recommended that in the activity layout you should add a button to open the inbox:
  4. In case you would like to show the number of unread message to the user, you can fetch them by using the following command:
    Appoxee.getUnreadMessages();

Step 5 - Push Icon Customization

To change the icon on the Android Push Notification panel:

  1. In the "Appoxee resources/res/drawable" replace "appoxee_default_icon.png" with another icon file.
  2. In the application project create a “drawable” resource by the name "appoxee_custom_icon.png". It will be used instead of the default one.

Step 6 - Inbox Customization

Appoxee Pro accounts can also change the Inbox design and customize its environment (this section is relevant for Appoxee Pro clients only. If you wish to upgrade to Pro please contact info@appoxee.com).

Step 7 -Try our feedback module

If you are using the Appoxee Inbox, all you have to do is enable it in your Appoxee app settings and hooray! check your inbox for our feedback module.

Step 8 - Testing your Application

After completing the steps above, try to build and run your application on your device. You can see in your debug console (LogCAT for Eclipse users) the logging process. 

Step 9 - Validate your integration

  1. Test a push notification - if you have any problems, please read our Android Q&A section, it might be something common.
  2. If you have utilized the Appoxee In-App inbox – Please test the combination of Message + Push.
  3. Setup the push sending rate (in case you want to throttle incoming traffic when users click on your push notifications).
  4. Create your first Welcome Message using “Persistent” Message Type.
NOTE
When encountering an issue or a question, please contact our support support@appoxee.com with the extracted log file.

...

 

Legacy Android SDK

Any customers who are newly integrating the Appoxee Android SDK should use the newer v4 library detailed above.

For customers who have already integrated, documentation on the legacy v2 Android SDK can be found at Appoxee SDK integration v2