Based on the latest documentation from LinkedIn, you should be using the DeepLinkHelper
to integrate deep-linking with the official app:
// Get a reference to an activity to return the user to
final Activity thisActivity = this;
// A sample member ID value to open
final String targetID = "abcd1234";
DeepLinkHelper deepLinkHelper = DeepLinkHelper.getInstance();
// Open the target LinkedIn member's profile
deepLinkHelper.openOtherProfile(thisActivity, targetID, new DeeplinkListener() {
@Override
public void onDeepLinkSuccess() {
// Successfully sent user to LinkedIn app
}
@Override
public void onDeepLinkError(LiDeepLinkError error) {
// Error sending user to LinkedIn app
}
});
Or prefer the following to open the profile of the currently authenticated user:
// Get a reference to an activity to return the user to
final Activity thisActivity = this;
DeepLinkHelper deepLinkHelper = DeepLinkHelper.getInstance();
// Open the current user's profile
deepLinkHelper.openCurrentProfile(thisActivity, new DeeplinkListener() {
@Override
public void onDeepLinkSuccess() {
// Successfully sent user to LinkedIn app
}
@Override
public void onDeepLinkError(LiDeepLinkError error) {
// Error sending user to LinkedIn app
}
});
Either way, if dive into the implementation of the DeepLinkHelper
, you'll see that it ends up constructing the Intent
that opens the LinkedIn app like this:
private void deepLinkToProfile(@NonNull Activity activity, String memberId, @NonNull AccessToken accessToken) {
Intent i = new Intent("android.intent.action.VIEW");
Uri.Builder uriBuilder = new Uri.Builder();
uriBuilder.scheme("linkedin");
if (CURRENTLY_LOGGED_IN_MEMBER.equals(memberId)) {
uriBuilder.authority(CURRENTLY_LOGGED_IN_MEMBER);
} else {
uriBuilder.authority("profile").appendPath(memberId);
}
uriBuilder.appendQueryParameter("accessToken", accessToken.getValue());
uriBuilder.appendQueryParameter("src", "sdk");
i.setData(uriBuilder.build());
Log.i("Url: ", uriBuilder.build().toString());
activity.startActivityForResult(i, LI_SDK_CROSSLINK_REQUEST_CODE);
}
As you can see, amongst other things, it attaches the access token to the Uri
as a query parameter with key accessToken
. The other query parameter that gets added is src
, which (presumably) is just used for statistical purposes and not something functional.
Now, if you look at this particular line in your error log:
E/com.linkedin.android.deeplink.helper.LaunchHelper﹕ urlParams was null, indicating a failure to validate the path in getMap()
Note:
urlParams was null
That sounds to me like it is expecting one ore more query parameters for the data Uri
. I'm inclined to say that that is most likely referring to (at least) the accessToken
query parameter that is missing in your own code snippet, yet is part of the SDK flow.
Hopefully that's a push in the right direction. It might be easiest to just use the LinkedIn SDK - any particular reason you aren't?