In a call with a customer here in Switzerland, the question came up whether moving from the Mobile Services SDK (vulgo “v4”) to the Experience Platform Mobile SDKs (“v5”) would lead to a spike in the “First Launches” metric or not.
My guess was no.
I thought I had heard someone say at some point that the v5 SDKs would quite happily read the data left behind by the v4 SDKs, and that things like the visitor ID would therefore survive an upgrade.
I asked around, and we all agreed, but noone knew for sure.
So I did what a blogger has to do: I tried it.
The Test
I built a really simple app using the v4 Mobile Services SDK for Android, like this:
package com.exner.test.firstlaunchestest; import android.os.Bundle; import com.adobe.mobile.Analytics; import com.adobe.mobile.Config; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Your tap was tracked", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); Analytics.trackAction("Button tapped", null); } }); // Adobe - init the SDK Config.setContext(this.getApplicationContext()); Config.setDebugLogging(true); // Adobe - track when this state loads Analytics.trackState("Main Activity", null); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override protected void onPause() { Config.pauseCollectingLifecycleData(); super.onPause(); } @Override protected void onResume() { super.onResume(); Config.collectLifecycleData(); } }
I ran it on the emulator, then deleted the app and ran it again. Expectation was to see 2 First Launches and 2 Visitors in my “First Launches Test” Report Suite.
Again, I added lifecycle calls, trackState(), and trackAction(), in the same places.
package com.exner.test.firstlaunchestest; import android.os.Bundle; import com.adobe.marketing.mobile.AdobeCallback; import com.adobe.marketing.mobile.Analytics; import com.adobe.marketing.mobile.Identity; import com.adobe.marketing.mobile.InvalidInitException; import com.adobe.marketing.mobile.Lifecycle; import com.adobe.marketing.mobile.LoggingMode; import com.adobe.marketing.mobile.MobileCore; import com.adobe.marketing.mobile.Signal; import com.adobe.marketing.mobile.UserProfile; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Your tap was tracked", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); MobileCore.trackAction("Button tap", null); } }); MobileCore.setApplication(this.getApplication()); MobileCore.setLogLevel(LoggingMode.DEBUG); try { Analytics.registerExtension(); UserProfile.registerExtension(); Identity.registerExtension(); Lifecycle.registerExtension(); Signal.registerExtension(); MobileCore.start(new AdobeCallback() { @Override public void call(Object o) { MobileCore.configureWithAppID("3028746f70eb/378883202a73/launch-08c90ba25165"); } }); } catch (InvalidInitException e) { e.printStackTrace(); } MobileCore.trackState("Main Activity", null); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override protected void onPause() { MobileCore.lifecyclePause(); super.onPause(); } @Override protected void onResume() { super.onResume(); MobileCore.setApplication(getApplication()); MobileCore.lifecycleStart(null); } }
I launched the app on the same emulator. It did overwrite/upgrade the first one, and I configured it so it would track into the “First Launches Test” Report Suite AND a new Report Suite called “First Launches Test 2”.
Impatient Checking
Here’s the real time report for “First Launches Test”, containing the hits from both apps:
![[screenshot]](https://webanalyticsfordevelopers.files.wordpress.com/2020/07/200819-rt-rs2.png?w=656&h=379)
Result
Then I waited for the traffic to go through processing…
DRUMROLL
The v5 SDK seems to be able to read the data format used by the v4 SDK to store at least some of the information. The visitor ID survived the upgrade, too.
What I do NOT understand is why there is no “Upgrades”. I would have expected those to count up on launch of the new app, but they did not. Not quite relevant here, but puzzling.
My current guess is that Android didn’t count my new app as an upgrade. I did not specify versionCode
and versionName
in the manifest, but Google says I should have done that.
But if you are worried that changing SDKs is going to massively throw your metrics, don’t be. It won’t.
You can go from the v4 SDKs to the v5 SDKs and your data will be just fine.