Mobile Services API reference

extensionVersion

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:
Android
iOS (AEP 3.x)
iOS (ACP 2.x)

Java

1
String mobileServicesExtensionVersion = MobileServices.extensionVersion();
Copied!

Objective-C

1
NSString *mobileServicesExtensionVersion = [AEPMobileServices extensionVersion];
Copied!

Swift

1
let mobileServicesExtensionVersion = AEPMobileServices.extensionVersion()
Copied!

Objective-C

1
NSString *mobileServicesExtensionVersion = [ACPMobileServices extensionVersion];
Copied!

Swift

1
let mobileServicesExtensionVersion = ACPMobileServices.extensionVersion()
Copied!

processReferrer

You can use this API to process the referrer intent that was received from Android.
This API is only available in Android.
Syntax
1
public static void processReferrer(final Context context, final Intent intent)
Copied!
Example
Java
1
public void onReceive(Context context, Intent intent) {
2
MobileServices.processReferrer(context, intent);
3
}
Copied!

processGooglePlayInstallReferrerUrl

You can use this API to process the data you get from the Google Play Install Referrer APIs.
This API is only available starting in Android version 1.1.0.

processReferrer

Syntax
1
public static void processGooglePlayInstallReferrerUrl(final Context context, final Intent intent)
Copied!
Example
Java
1
void handleGooglePlayReferrer() {
2
// Google recommends only calling this API the first time you need it:
3
// https://developer.android.com/google/play/installreferrer/library#install-referrer
4
5
// Store a boolean in SharedPreferences to ensure we only call it once.
6
final SharedPreferences prefs = getSharedPreferences("acquisition", 0);
7
if (prefs != null) {
8
if (prefs.getBoolean("referrerHasBeenProcessed", false)) {
9
return;
10
}
11
}
12
13
final InstallReferrerClient referrerClient = InstallReferrerClient.newBuilder(getApplicationContext()).build();
14
referrerClient.startConnection(new InstallReferrerStateListener() {
15
private boolean complete = false;
16
17
@Override
18
public void onInstallReferrerSetupFinished(int responseCode) {
19
switch (responseCode) {
20
case InstallReferrerClient.InstallReferrerResponse.OK:
21
// connection is established
22
complete();
23
try {
24
final ReferrerDetails details = referrerClient.getInstallReferrer();
25
26
// pass the install referrer url to the SDK
27
MobileServices.processGooglePlayInstallReferrerUrl(details.getInstallReferrer());
28
29
} catch (final RemoteException ex) {
30
Log.w("Acquisition - RemoteException while retrieving referrer information (%s)", ex.getLocalizedMessage() == null ? "unknown" : ex.getLocalizedMessage());
31
} finally {
32
referrerClient.endConnection();
33
}
34
break;
35
case InstallReferrerClient.InstallReferrerResponse.FEATURE_NOT_SUPPORTED:
36
case InstallReferrerClient.InstallReferrerResponse.SERVICE_UNAVAILABLE:
37
default:
38
// API not available in the Play Store app - nothing to do here
39
complete();
40
referrerClient.endConnection();
41
break;
42
}
43
}
44
45
@Override
46
public void onInstallReferrerServiceDisconnected() {
47
if (!complete) {
48
// something went wrong trying to get a connection, try again
49
referrerClient.startConnection(this);
50
}
51
}
52
53
void complete() {
54
complete = true;
55
SharedPreferences.Editor editor = getSharedPreferences("acquisition", 0).edit();
56
editor.putBoolean("referrerHasBeenProcessed", true);
57
editor.apply();
58
}
59
});
60
}
Copied!

trackAdobeDeepLink

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.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
Syntax
1
public static void trackAdobeDeepLink(final Uri uri)
Copied!
Example
Java
1
Uri testUri = new Uri.Builder()
2
.scheme("adobelinktest")
3
.appendQueryParameter("a.deeplink.id", "test_deeplinkId")
4
.appendQueryParameter("a.launch.campaign.trackingcode", "code")
5
.appendQueryParameter("test_key", "test_value")
6
.build();
7
8
MobileServices.trackAdobeDeepLink(testUri);
Copied!
Syntax
1
+ (void) trackAdobeDeepLink: (NSURL* _Nonnull) deeplink;
Copied!
Example
Objective-C
1
NSURL* url = [NSURL URLWithString:@"adobelinktest://x?a.deeplink.id=test_deeplinkId&a.launch.campaign.trackingcode=code&test_key=test_value"];
2
3
[AEPMobileServices trackAdobeDeepLink:url];
Copied!
Swift
1
let url = URL(string: "adobelinktest://x?a.deeplink.id=test_deeplinkId&a.launch.campaign.trackingcode=code&test_key=test_value")!
2
AEPMobileServices.trackAdobeDeepLink(url)
Copied!
Syntax
1
+ (void) trackAdobeDeepLink: (NSURL*) url;
Copied!
Example
Objective C
1
NSURL* url = [NSURL URLWithString:@"adobelinktest://x?a.deeplink.id=test_deeplinkId&a.launch.campaign.trackingcode=code&test_key=test_value"];
2
3
[ACPMobileServices trackAdobeDeepLink:url];
Copied!
Swift
1
let url = URL(string: "adobelinktest://x?a.deeplink.id=test_deeplinkId&a.launch.campaign.trackingcode=code&test_key=test_value")!
2
ACPMobileServices.trackAdobeDeepLink(url)
Copied!
Last modified 11d ago