The following instructions are for developers using Android Studio.
For Eclipse integration see: Alternative - Adding the Appoxee Android SDK Using Eclipse
We have simplified the process by creating an AAR file which can be downloaded from our download page.
The instructions are followed by some screenshots and code samples which will result the most basic integration with the Appoxee SDK.
The Test Application located in the download page contains a full code sample of what is written here.
1.Download the .AAR file from the download page.
...
3. Import the Appoxee SDK aar file
4. Select "Import .JAR/.AAR Package"
5. Select the Appoxee SDK aar file from the location you have saved it
6. Open Make sure your AndroidManifestapplication build.xml file after making sure the Appoxee SDK module is part of your project
7. Your gradle file include the applicationId attribute for android defaultConfig. Alternately, you can replace ${applicationId} with you application package (e.g com.yourapppackage.app). Also please add the following dependenices to your app's gradle.build file should look as follows (bare minimum) dependencies section :
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.0" defaultConfig { ... defaulfConfig { applicationId "com.appoxeeyourapppackage.testappapp" //make sure you have minSdkVersion 9 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions { exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } lintOptions { abortOnError false } } this ... } } ... dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.google.android.gms:play-services-gcm:78.51.0' //8.1.0 or above compile project(':appoxeesdk') } |
...
|
...
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appoxee.testapp" >
<permission android:name="com.appoxee.testapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.appoxee.testapp.permission.C2D_MESSAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- This app uses GooglePlayServices.jar -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- REQUIRED for C2DM -->
<service android:name="com.appoxee.gcm.PlayIntentService" />
<receiver
android:name="com.appoxee.gcm.PlayBroadcastReceiver"
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.testapp" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.appoxee.testapp" />
</intent-filter>
</receiver>
<activity android:name="com.appoxee.activities.Inbox" >
</activity>
<activity android:name="com.appoxee.activities.SplashScreen" >
</activity>
<activity android:name="com.appoxee.activities.Feedback" >
</activity>
<activity android:name="com.appoxee.activities.InboxMessage" >
</activity>
</application>
</manifest>
|
9. The Activity which implements the Appoxee SDK integration code and interface should look as follows (bare minimum) :
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
package com.appoxee.testapp;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import com.appoxee.Appoxee;
import com.appoxee.AppoxeeManager;
import com.appoxee.AppoxeeObserver;
import com.appoxee.asyncs.initAsync;
import com.appoxee.utils.Utils;
public class MainActivity extends AppCompatActivity implements AppoxeeObserver {
public static final String APPOXEE_APP_KEY = "YOUR_SDK_KEY";
public static final String APPOXEE_SECRET_KEY = "YOUR_SECRET_KEY";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
new initAsync(getApplicationContext(),APPOXEE_APP_KEY,APPOXEE_SECRET_KEY,"",true,"",this).execute();
//Set Debug Logging as true for LogCAT
AppoxeeManager.setDebug(true);
//Parse Extra fields from incoming push messages
Bundle bundle = getIntent().getExtras();
Appoxee.parseExtraFields(bundle);
}
@Override
protected void onStart()
{
super.onStart();
Appoxee.onStart();
}
@Override
protected void onStop()
{
super.onStop();
Appoxee.onStop();
}
@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
Bundle bundle = intent.getExtras();
Appoxee.parseExtraFields(bundle);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onRegistrationCompleted() {
}
@Override
public void onMessagesUpdateCompleted() {
}
}
|
10. After completing all the steps run your app for the first time and your are done!
11. If you wish to use the SDK Sync API's - press here
12. If you wish to use the SDK Async API's - press here
13. If you wish to use the Custom Push Notification Builder - press here
...
//in case you want to use our in-app inbox, or use proguard:
//compile 'com.j256.ormlite:ormlite-core:4.48'
//compile 'com.j256.ormlite:ormlite-android:4.48'
}
|