The extensionVersion()
API returns the version of the Mobile Services extension that is registered with the Mobile Core extension.
To get the version of the Mobile Services extension, use the following code sample:
{% tabs %} {% tab title="Android" %}
String mobileServicesExtensionVersion = MobileServices.extensionVersion();
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
NSString *mobileServicesExtensionVersion = [AEPMobileServices extensionVersion];
let mobileServicesExtensionVersion = AEPMobileServices.extensionVersion()
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
NSString *mobileServicesExtensionVersion = [ACPMobileServices extensionVersion];
let mobileServicesExtensionVersion = ACPMobileServices.extensionVersion()
{% endtab %}
{% endtabs %}
You can use this API to process the referrer intent that was received from Android.
{% hint style="warning" %} This API is only available in Android. {% endhint %}
Syntax
public static void processReferrer(final Context context, final Intent intent)
Example
Java
public void onReceive(Context context, Intent intent) {
MobileServices.processReferrer(context, intent);
}
You can use this API to process the data you get from the Google Play Install Referrer APIs.
{% hint style="warning" %}
This API is only available starting in Android version 1.1.0
.
{% endhint %}
Syntax
public static void processGooglePlayInstallReferrerUrl(final Context context, final Intent intent)
Example
Java
void handleGooglePlayReferrer() {
// Google recommends only calling this API the first time you need it:
// https://developer.android.com/google/play/installreferrer/library#install-referrer
// Store a boolean in SharedPreferences to ensure we only call it once.
final SharedPreferences prefs = getSharedPreferences("acquisition", 0);
if (prefs != null) {
if (prefs.getBoolean("referrerHasBeenProcessed", false)) {
return;
}
}
final InstallReferrerClient referrerClient = InstallReferrerClient.newBuilder(getApplicationContext()).build();
referrerClient.startConnection(new InstallReferrerStateListener() {
private boolean complete = false;
@Override
public void onInstallReferrerSetupFinished(int responseCode) {
switch (responseCode) {
case InstallReferrerClient.InstallReferrerResponse.OK:
// connection is established
complete();
try {
final ReferrerDetails details = referrerClient.getInstallReferrer();
// pass the install referrer url to the SDK
MobileServices.processGooglePlayInstallReferrerUrl(details.getInstallReferrer());
} catch (final RemoteException ex) {
Log.w("Acquisition - RemoteException while retrieving referrer information (%s)", ex.getLocalizedMessage() == null ? "unknown" : ex.getLocalizedMessage());
} finally {
referrerClient.endConnection();
}
break;
case InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED:
case InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE:
default:
// API not available in the Play Store app - nothing to do here
complete();
referrerClient.endConnection();
break;
}
}
@Override
public void onInstallReferrerServiceDisconnected() {
if (!complete) {
// something went wrong trying to get a connection, try again
referrerClient.startConnection(this);
}
}
void complete() {
complete = true;
SharedPreferences.Editor editor = getSharedPreferences("acquisition", 0).edit();
editor.putBoolean("referrerHasBeenProcessed", true);
editor.apply();
}
});
}
You can use this API to track a deep link or a marketing link, as long as the link contains a key a.deeplink.id
and a corresponding non-null and user generated value. The link can be created in the Adobe Mobile Services UI or be generated by another vendor.
{% tabs %} {% tab title="Android" %}
Syntax
public static void trackAdobeDeepLink(final Uri uri)
Example
Java
Uri testUri = new Uri.Builder()
.scheme("adobelinktest")
.appendQueryParameter("a.deeplink.id", "test_deeplinkId")
.appendQueryParameter("a.launch.campaign.trackingcode", "code")
.appendQueryParameter("test_key", "test_value")
.build();
MobileServices.trackAdobeDeepLink(testUri);
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
+ (void) trackAdobeDeepLink: (NSURL* _Nonnull) deeplink;
Example
Objective-C
NSURL* url = [NSURL URLWithString:@"adobelinktest://x?a.deeplink.id=test_deeplinkId&a.launch.campaign.trackingcode=code&test_key=test_value"];
[AEPMobileServices trackAdobeDeepLink:url];
Swift
let url = URL(string: "adobelinktest://x?a.deeplink.id=test_deeplinkId&a.launch.campaign.trackingcode=code&test_key=test_value")!
AEPMobileServices.trackAdobeDeepLink(url)
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
+ (void) trackAdobeDeepLink: (NSURL*) url;
Example
Objective C
NSURL* url = [NSURL URLWithString:@"adobelinktest://x?a.deeplink.id=test_deeplinkId&a.launch.campaign.trackingcode=code&test_key=test_value"];
[ACPMobileServices trackAdobeDeepLink:url];
Swift
let url = URL(string: "adobelinktest://x?a.deeplink.id=test_deeplinkId&a.launch.campaign.trackingcode=code&test_key=test_value")!
ACPMobileServices.trackAdobeDeepLink(url)
{% endtab %}
{% endtabs %}