Android SDK integration / Migrating from previous versions |
Use this guide if you have integrated the Localytics library 3.0 into your app and are ready to upgrade to 3.1.
To ensure proper initialization and push message tracking, we made several important changes in SDK 3.1. These changes require a few adjustments to how the SDK is integrated into your app. If you are migrating from 3.0, please follow the steps below to make the appropriate adjustments.
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Remove the next 2 lines getApplication().registerActivityLifecycleCallbacks( new LocalyticsActivityLifecycleCallbacks(this)); }
<application android:name=".MyApplication" android:icon="@drawable/ic_launcher" android:label="@string/app_name">
public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); // Register LocalyticsActivityLifecycleCallbacks registerActivityLifecycleCallbacks( new LocalyticsActivityLifecycleCallbacks(this)); } }
<application android:name=".MyApplication" android:icon="@drawable/ic_launcher" android:label="@string/app_name">
public class MyApplication extends Application { @Override public void onCreate() { super.onCreate(); // Integrate Localytics Localytics.integrate(this); } }
<activity android:name="com.localytics.android.PushTrackingActivity"/>