Skip to content

Source code for the Laudspeaker Android libraries in Java.

Notifications You must be signed in to change notification settings

laudspeaker/laudspeaker-android-sdk

Repository files navigation

Laudspeaker Android SDK Integration

Setup

To setup Laudspeaker Android SDK perform these steps:

  • Add laudspeaker dependency:
implementation "........."
  • Perform Grandle sync
  • Add required permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />

Example

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  // initialize firebase integration
  FirebaseApp.initializeApp(this);

  ...

  // create instance
  LaudspeakerAndroid laudspeakerAndroid = new LaudspeakerAndroid(getPreferences(MODE_PRIVATE));

  // describe customer's unique properties for identification
  Map<String, Object> uniquePropertiesMap = new HashMap<>();
  uniquePropertiesMap.put("email", "[email protected]");

  // implement onConnect listener
  ConnectListener connectListener = () -> {
    // identify the customer
    laudspeakerAndroid.identify(uniquePropertiesMap);
    // retrive and assign customer's FCM token
    laudspeakerAndroid.sendFCMToken();
  };

  laudspeakerAndroid.onConnected(connectListener);

  // connect to laudspeaker services using your api token and host
  try {
    laudspeakerAndroid.connect("YOUR_API_KEY", "https://laudspeaker.com");
  } catch (URISyntaxException e) {
    throw new RuntimeException(e);
  }
}

About

Source code for the Laudspeaker Android libraries in Java.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages