本文整理汇总了Java中com.google.android.gms.appinvite.AppInviteReferral.getDeepLink方法的典型用法代码示例。如果您正苦于以下问题:Java AppInviteReferral.getDeepLink方法的具体用法?Java AppInviteReferral.getDeepLink怎么用?Java AppInviteReferral.getDeepLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.appinvite.AppInviteReferral
的用法示例。
在下文中一共展示了AppInviteReferral.getDeepLink方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processReferralIntent
import com.google.android.gms.appinvite.AppInviteReferral; //导入方法依赖的package包/类
private void processReferralIntent(Intent intent) {
if (!AppInviteReferral.hasReferral(intent)) {
Log.e(TAG, "Error: DeepLinkActivity Intent does not contain App Invite");
return;
}
// Extract referral information from the intent
String invitationId = AppInviteReferral.getInvitationId(intent);
String deepLink = AppInviteReferral.getDeepLink(intent);
// Display referral information
// [START_EXCLUDE]
Log.d(TAG, "Found Referral: " + invitationId + ":" + deepLink);
((TextView) findViewById(R.id.deep_link_text))
.setText(getString(R.string.deep_link_fmt, deepLink));
((TextView) findViewById(R.id.invitation_id_text))
.setText(getString(R.string.invitation_id_fmt, invitationId));
// [END_EXCLUDE]
if (mGoogleApiClient.isConnected()) {
// Notify the API of the install success and invitation conversion
updateInvitationStatus(intent);
} else {
// Cache the invitation ID so that we can call the AppInvite API after
// the GoogleAPIClient connects
Log.w(TAG, "Warning: GoogleAPIClient not connected, can't update invitation.");
mCachedInvitationIntent = intent;
}
}
示例2: onResult
import com.google.android.gms.appinvite.AppInviteReferral; //导入方法依赖的package包/类
@Override public void onResult(@NonNull AppInviteInvitationResult result) {
if (result.getStatus().isSuccess()) {
Intent intent = result.getInvitationIntent();
String deepLink = AppInviteReferral.getDeepLink(intent);
Uri data = intent.getData();
String userId = data.getQueryParameter(BuildConfig.SHARED_URI);
Logger.e(deepLink, data, userId);
if (!InputHelper.isEmpty(userId)) {
if (isAttached()) getView().onRestoreFromUserId(userId);
}
} else {
Logger.e("no deep link found.");
}
}
示例3: processReferralIntent
import com.google.android.gms.appinvite.AppInviteReferral; //导入方法依赖的package包/类
private void processReferralIntent(Intent intent) {
// Confirm receipt of the invitation
if (getFragment().isConnected()) {
updateInvitationStatus(intent);
} else {
Log.w(TAG, "GoogleAPIClient not connected, can't update invitation.");
mCachedInvitationIntent = intent;
}
// Notify the listener of the received invitation
String invitationId = AppInviteReferral.getInvitationId(intent);
String deepLink = AppInviteReferral.getDeepLink(intent);
getListener().onInvitationReceived(invitationId, deepLink);
}
示例4: processReferral
import com.google.android.gms.appinvite.AppInviteReferral; //导入方法依赖的package包/类
/**
* Process app invitation referral.
*
* @param intent Invitation intent to process.
*/
private void processReferral(Intent intent) {
if (AppInviteReferral.hasReferral(intent)) {
String invitationId = AppInviteReferral.getInvitationId(intent);
String deepLink = AppInviteReferral.getDeepLink(intent);
Timber.i("Invite referral: Invitation Id=%s, Deep link=%s", invitationId, deepLink);
new AlertDialog.Builder(this, R.style.GallaudetTheme_AlertDialog)
.setTitle(getString(R.string.invite_dialog_title))
.setMessage(R.string.invite_dialog_message)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.create()
.show();
if (googleApiClient.isConnected()) {
updateInvitationStatus(intent);
} else {
Timber.w("googleApiClient not connected, cannot update invitation.");
cachedInvitationIntent = intent;
}
}
}