Skip to content

Instantly share code, notes, and snippets.

@grantmiller
Last active August 29, 2015 14:00
Show Gist options
  • Save grantmiller/c569fa4302f2dd6b4750 to your computer and use it in GitHub Desktop.
Save grantmiller/c569fa4302f2dd6b4750 to your computer and use it in GitHub Desktop.

#LPMobile Android Library Basic Implementation

  1. Copy Branding.settings into the /assets folder in the app. If the app is using Gradle, then the file should be copied into /[app_name]/src/main/assets (create this folder if not present).

###Required changes to AndroidManifest.xml 2. Add the following 3 permissions:

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
  1. Add the following 2 activities:
<activity android:name="com.liveperson.mobile.android.ui.chat.ChatMainActivity"
    android:label="@string/title_activity_lpmobile"
    android:theme="@style/Theme.Transparent">
</activity>
<activity android:name="com.liveperson.mobile.android.ui.ChatAlertActivity"
    android:label="@string/title_activity_lpmobile"
    android:launchMode="singleInstance"
    android:theme="@style/Theme.Transparent">
</activity>
  1. Add the following service:
<service android:enabled="true" android:name="com.liveperson.mobile.android.service.visit.VisitService" />

###Required changes to res/values/strings.xml 5. Add the following element:

<string name="title_activity_lpmobile">Live Chat Input</string>

###Required changes to res/values/styles.xml 6. Add the following element:

<style name="Theme.Transparent" parent="android:Theme.Light">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:backgroundDimEnabled">true</item>
</style>

###Required changes to main activity: 7. In onStart or onCreate add the following below super.onStart();:

LivePerson.init(this);
  1. Add the following import statement to this activity:
import com.liveperson.mobile.android.LivePerson;

###Required changes to the application object: 9. Create the application object, if not present and add it to the AndroidManifest.xml. 10. Add the following code in the onCreate function:

if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {

    // Register to the ActivityLifecycleCallbacks in order to support notifications

    registerActivityLifecycleCallbacks(new ApplicationLifecycleHandler());

}
  1. Add the following 2 import statements to this application object:
import android.os.Build;
import com.liveperson.mobile.android.service.ApplicationLifecycleHandler;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment