当前位置: 首页>>代码示例>>Java>>正文


Java AppInviteReferral类代码示例

本文整理汇总了Java中com.google.android.gms.appinvite.AppInviteReferral的典型用法代码示例。如果您正苦于以下问题:Java AppInviteReferral类的具体用法?Java AppInviteReferral怎么用?Java AppInviteReferral使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AppInviteReferral类属于com.google.android.gms.appinvite包,在下文中一共展示了AppInviteReferral类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onNewIntent

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
@Override
protected void onNewIntent(Intent intent)
{
    super.onNewIntent(intent);

    if( intent == null )
    {
        return;
    }

    // App invites
    if (AppInviteReferral.hasReferral(intent))
    {
        updateInvitationStatus(intent);
    }

    openSettingsIfNeeded(intent);
    openMonthlyReportIfNeeded(intent);
    openPremiumIfNeeded(intent);
    openAddExpenseIfNeeded(intent);
    openAddRecurringExpenseIfNeeded(intent);
}
 
开发者ID:benoitletondor,项目名称:EasyBudget,代码行数:23,代码来源:MainActivity.java

示例2: onCreate

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    // [START_EXCLUDE]
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    // Invite button click listener
    findViewById(R.id.invite_button).setOnClickListener(this);
    // [END_EXCLUDE]

    if (savedInstanceState == null) {
        // No savedInstanceState, so it is the first launch of this activity
        Intent intent = getIntent();
        if (AppInviteReferral.hasReferral(intent)) {
            // In this case the referral data is in the intent launching the MainActivity,
            // which means this user already had the app installed. We do not have to
            // register the Broadcast Receiver to listen for Play Store Install information
            launchDeepLinkActivity(intent);
        }
    }
}
 
开发者ID:rokity,项目名称:GCM-Sample,代码行数:22,代码来源:MainActivity.java

示例3: registerDeepLinkReceiver

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
/**
 * There are two broadcast receivers in this application.  The first is ReferrerReceiver, it
 * is a global receiver declared in the manifest.  It receives broadcasts from the Play Store
 * and then broadcasts messages to the local broadcast receiver, which is registered here.
 * Since the broadcast is asynchronous, it can occur after the app has started, so register
 * for the notification immediately in onStart. The Play Store broadcast should be very soon
 * after the app is first opened, so this receiver should trigger soon after start
 */
// [START register_unregister_launch]
private void registerDeepLinkReceiver() {
    // Create local Broadcast receiver that starts DeepLinkActivity when a deep link
    // is found
    mDeepLinkReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (AppInviteReferral.hasReferral(intent)) {
                launchDeepLinkActivity(intent);
            }
        }
    };

    IntentFilter intentFilter = new IntentFilter(getString(R.string.action_deep_link));
    LocalBroadcastManager.getInstance(this).registerReceiver(
            mDeepLinkReceiver, intentFilter);
}
 
开发者ID:rokity,项目名称:GCM-Sample,代码行数:26,代码来源:MainActivity.java

示例4: updateInvitationStatus

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
/** Update the install and conversion status of an invite intent **/
// [START update_invitation_status]
private void updateInvitationStatus(Intent intent) {
    String invitationId = AppInviteReferral.getInvitationId(intent);

    // Note: these  calls return PendingResult(s), so one could also wait to see
    // if this succeeds instead of using fire-and-forget, as is shown here
    if (AppInviteReferral.isOpenedFromPlayStore(intent)) {
        AppInvite.AppInviteApi.updateInvitationOnInstall(mGoogleApiClient, invitationId);
    }

    // If your invitation contains deep link information such as a coupon code, you may
    // want to wait to call `convertInvitation` until the time when the user actually
    // uses the deep link data, rather than immediately upon receipt
    AppInvite.AppInviteApi.convertInvitation(mGoogleApiClient, invitationId);
}
 
开发者ID:rokity,项目名称:GCM-Sample,代码行数:17,代码来源:DeepLinkActivity.java

示例5: onStart

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
@Override
public void onStart() {
    super.onStart();

    // If app is already installed app and launched with deep link that matches
    // DeepLinkActivity filter, then the referral info will be in the intent.
    Intent launchIntent = getFragment().getActivity().getIntent();
    if (AppInviteReferral.hasReferral(launchIntent)) {
        processReferralIntent(launchIntent);
    }

    // Register the local BroadcastReceiver
    IntentFilter intentFilter = new IntentFilter(
            getFragment().getString(R.string.action_deep_link));
    LocalBroadcastManager.getInstance(getFragment().getActivity()).registerReceiver(
            mDeepLinkReceiver, intentFilter);
}
 
开发者ID:googlearchive,项目名称:easygoogle,代码行数:18,代码来源:AppInvites.java

示例6: onReceive

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent)
{
    // Forward to Google analytics
    new CampaignTrackingReceiver().onReceive(context, intent);

    // Create deep link intent with correct action and add play store referral information
    Intent refIntent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(MainActivity.buildAppInvitesReferrerDeeplink(context)));

    Intent deepLinkIntent = AppInviteReferral.addPlayStoreReferrerToIntent(intent, refIntent);
    LocalBroadcastManager.getInstance(context).sendBroadcast(deepLinkIntent);
}
 
开发者ID:benoitletondor,项目名称:EasyBudget,代码行数:14,代码来源:ReferrerReceiver.java

示例7: onReceive

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
    // Create deep link intent with correct action and add play store referral information
    Intent deepLinkIntent = AppInviteReferral.addPlayStoreReferrerToIntent(intent,
            new Intent(context.getString(R.string.action_deep_link)));

    // Let any listeners know about the change
    LocalBroadcastManager.getInstance(context).sendBroadcast(deepLinkIntent);
}
 
开发者ID:rokity,项目名称:GCM-Sample,代码行数:10,代码来源:ReferrerReceiver.java

示例8: 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;
    }
}
 
开发者ID:rokity,项目名称:GCM-Sample,代码行数:30,代码来源:DeepLinkActivity.java

示例9: testDeepLink

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
@Test
public void testDeepLink() {
    // Create intent to MainActivity
    Intent deepLinkIntent = new Intent()
        .setClassName(APP_PACKAGE, APP_PACKAGE + ".MainActivity")
        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);

    // Load it with AppInvite information
    String invitationId = "12345";
    String deepLink = "http://example.com/12345";
    AppInviteReferral.addReferralDataToIntent(invitationId, deepLink, deepLinkIntent);

    // Start activity
    mContext.startActivity(deepLinkIntent);

    // Check that invitation ID is displayed
    String invitationIdText = mContext.getString(R.string.invitation_id_fmt, invitationId);
    assertTrue(mDevice.wait(Until.hasObject(By.text(invitationIdText)), UI_TIMEOUT));

    // Check that deep link is displayed
    String deepLinkText = mContext.getString(R.string.deep_link_fmt, deepLink);
    assertTrue(mDevice.wait(Until.hasObject(By.text(deepLinkText)), UI_TIMEOUT));

    // Make sure there is an OK button, click it
    String okText = mContext.getString(android.R.string.ok);
    assertTrue(mDevice.wait(Until.hasObject(By.text(okText)), UI_TIMEOUT));
    mDevice.findObject(By.text(okText)).click();

    // Make sure that the dialog is gone
    String dialogTitleText = mContext.getString(R.string.invite_dialog_title);
    assertTrue(mDevice.wait(Until.gone(By.text(dialogTitleText)), UI_TIMEOUT));
}
 
开发者ID:rokity,项目名称:GCM-Sample,代码行数:33,代码来源:UiAutomatorTest.java

示例10: 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.");
    }
}
 
开发者ID:k0shk0sh,项目名称:FastAccess,代码行数:15,代码来源:MainPresenter.java

示例11: AppInvites

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
protected AppInvites() {
    // Instantiate local BroadcastReceiver for receiving broadcasts from
    // AppInvitesReferralReceiver.
    mDeepLinkReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            // First, check if the Intent contains an AppInvite
            if (AppInviteReferral.hasReferral(intent)) {
               processReferralIntent(intent);
            }
        }
    };
}
 
开发者ID:googlearchive,项目名称:easygoogle,代码行数:14,代码来源:AppInvites.java

示例12: 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);
}
 
开发者ID:googlearchive,项目名称:easygoogle,代码行数:16,代码来源:AppInvites.java

示例13: updateInvitationStatus

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
private void updateInvitationStatus(Intent intent) {
    // Extract invitation Id
    String invitationId = AppInviteReferral.getInvitationId(intent);

    // Update invitation installation status and also convert the invitation.
    GoogleApiClient gac = getFragment().getGoogleApiClient();
    if (AppInviteReferral.isOpenedFromPlayStore(intent)) {
        AppInvite.AppInviteApi.updateInvitationOnInstall(gac, invitationId);
    }

    AppInvite.AppInviteApi.convertInvitation(gac, invitationId);
}
 
开发者ID:googlearchive,项目名称:easygoogle,代码行数:13,代码来源:AppInvites.java

示例14: 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;
        }
    }
}
 
开发者ID:tjyu1040,项目名称:GallyShuttle,代码行数:33,代码来源:HomeActivity.java

示例15: updateInvitationStatus

import com.google.android.gms.appinvite.AppInviteReferral; //导入依赖的package包/类
/**
 * Mark invitation as successful.
 *
 * @param invitationIntent Intent to update invitation installation success.
 */
private void updateInvitationStatus(Intent invitationIntent) {
    String invitationId = AppInviteReferral.getInvitationId(invitationIntent);
    if (AppInviteReferral.isOpenedFromPlayStore(invitationIntent)) {
        AppInvite.AppInviteApi.updateInvitationOnInstall(googleApiClient, invitationId);
    }
    AppInvite.AppInviteApi.convertInvitation(googleApiClient, invitationId);
}
 
开发者ID:tjyu1040,项目名称:GallyShuttle,代码行数:13,代码来源:HomeActivity.java


注:本文中的com.google.android.gms.appinvite.AppInviteReferral类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。