#LPMobile Android Library Basic Implementation
- 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"/>
- 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>
- 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);
- 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());
}
- Add the following 2 import statements to this application object:
import android.os.Build;
import com.liveperson.mobile.android.service.ApplicationLifecycleHandler;