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.
...
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. Please add the following lines 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 dependencies section (after step 5 is complete) ::
Code Block | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
... dependenciesandroid { compile 'com.google.android.gms:play-services-gcm:7.5.0' compile project(':appoxeesdk') } |
8. Please add the following lines to your app's AndroidManifest.xml file :
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=" ... defaulfConfig { applicationId "com.yourapppackage.app" //make sure you have this ... } } ... dependencies { compile 'com.google.android.gms.version" android:value="@integer/google_play_services_version" /> ... <!-- 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> ... </application> </manifest> |
9. Please add the following code to the activity which implements AppoxeeObserver :
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
package com.appoxee.testapp;
...
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);
//The rest of your code
}
@Override
protected void onStart()
{
super.onStart();
Appoxee.onStart();
//The rest of your code
}
@Override
protected void onStop()
{
super.onStop();
Appoxee.onStop();
//The rest of your code
}
@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
Bundle bundle = intent.getExtras();
Appoxee.parseExtraFields(bundle);
//The rest of your code
}
...
}
|
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
...
play-services-gcm:8.1.0' //8.1.0 or above
compile project(':appoxeesdk')
//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'
}
|