Getting Started

0. Minimum Requirements

  • Android API Level 21

  • AndroidX Compatibility

  • Compile and Target SDK version 34

  • Build Tool Version 34

1. Installing Android SDK

1) Add the following repository to your project’s build.gradle file under allprojects.

	allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
		}
	}

2) Add the following dependency to the module’s build.gradle file under dependencies.

	dependencies {
	        implementation 'com.github.adxcorp:talkplus-android:0.6.0'
	}

2. Initialize

1) Before using TalkPlus SDK, make sure to initialize in onCreate either in Application or Main Activity.

public class SampleApplication extends MultiDexApplication {
    @Override
    public void onCreate() {
        super.onCreate();

        TalkPlus.init(getApplicationContext(), "YOUR_APP_ID");
    }
}

3. Login / Logout Process

  • You need to login (either using loginWithAnonymous or loginWithToken) once TalkPlus SDK has been initialized.

  • Once user is logged in, FCM token that was registered stays valid until the user logs out. This lets the user receive push notifications even when offline.

  • When user logs out, make sure to call logout function. If this step is omitted and a different user logs into the same device, the latter user will continue to receive push messages intended for the previous user.

4. Realtime Message

  • TalkPlus subscribes/unsubscribes to realtime channels in sync with the Android Activity Lifecycle.

  • TalkPlus SDK uses WebSocket to receive messages when your app is in foreground. When you app goes to background, SDK uses FCM to receive messages.

  • If you intend to receive messages when app goes into background, please refer to Push Notification section on how to set up FCM.

  • FCM integration is used alongside WebSocket in order to minimize app battery consumption.

Last updated