1

我想实现应用程序的延迟链接,在应用程序首次安装后处理链接参数。onInstallConversionData方法在应用程序已安装时调用,但不是在首次启动时调用。我在 App.tsx 中实现了这段代码。

       const onInstallConversionDataCanceller = appsFlyer.onInstallConversionData(
            (res: any) => {
                if (JSON.parse(res.data.is_first_launch) == true) {
                    if (res.data.af_status === 'Non-organic') {
                        const media_source = res.data.media_source;
                        const campaign = res.data.campaign;
                        console.log(
                            'This is first launch and a Non-Organic install. Media source: ' +
                                media_source +
                                ' Campaign: ' +
                                campaign,
                        );
                    } else if (res.data.af_status === 'Organic') {
                        console.log('This is first launch and a Organic Install');
                    }
                } else {
                    console.log('This is not first launch');
                }
            },
        );
        appsFlyer.initSdk(
            {
                devKey: 'key',
                isDebug: false, // set to true if you want to see data in the logs
                appId: '1234567', // iOS app id
            },
            (result: any) => {
                console.log(result);
            },
            (error: any) => {
                console.error(error);
            },
        );
        return () => {
            onInstallConversionDataCanceller();
            console.log('unregister onInstallConversionDataCanceller');
            onAppOpenAttributionCanceller();
            console.log('unregister onAppOpenAttributionCanceller');
        };

onNewIntent我在 MainActivity 类中也有实现:

    public void onNewIntent(Intent intent) {
         super.onNewIntent(intent);
         setIntent(intent);
    }
4

0 回答 0