AppsFlyerSDK / appsflyer-cordova-plugin

AppsFlyer plugin for Cordova
MIT License
37 stars 71 forks source link

onInstallConversionFailure : Error connection to server: 400 #134

Closed yaseen-nadaf closed 3 years ago

yaseen-nadaf commented 3 years ago

Report

Plugin Version

5.30.0

On what Platform are you having the issue?

SDK version : 6.1.0.64, Platform: Ionic Capacitor Project @ionic/angular": "^5.0.0",

What did you do?

Followed this URL https://github.com/AppsFlyerSDK/appsflyer-cordova-plugin, installed capacitor plugin, imported and provided in app.module.ts, inside app.component.ts under constructor initialized SDK with devKey, isDebug -> true, onInstallConversionDataListener -> true.

Whitelisted the testing mobile by installing the "My Device ID" App from Google Play Store.

Gave android permission to access the wifi state.

specified this in AndroidManifest.xml under provider: <meta-data android:name="CHANNEL" android:value="standalone"/> got this from react-native issues.

Went to Appsflyer dashboard -> SDK Integration Tests -> Non-organic Test -> Selected Whitelisted Mobile -> Scanned QR Code -> Installed app from Android Studio.

What did you expect to happen?

The non-organic test available on AppsFlyer Dashboard to succeed, give organic and non-organic install data.

What happened instead?

Getting this object as the response of initSdk: { "status":"failure", "type":"onInstallConversionFailure", "data":"Error connection to server: 400" }

Please provide any other relevant information.

Created an APP on the dashboard with the package name, it's not available on the Google Play store so gave the channel a website domain from where we can download the app.

Following is the complete log from logcat in Android Studio

2020-12-30 15:47:38.998 14512-14834/ V/Capacitor/Plugin: To native (Cordova plugin): callbackId: AppsFlyerPlugin1089301629, service: AppsFlyerPlugin, action: initSdk, actionArgs: [{"devKey":"","isDebug":true,"onInstallConversionDataListener":true}] 2020-12-30 15:47:38.999 14512-14834/ D/AppsFlyer: Executing... 2020-12-30 15:47:39.025 14512-14834/ D/AppsFlyer: Starting Tracking 2020-12-30 15:47:39.030 14512-14834/ D/AppsFlyer_6.1.0: Install referrer is allowed 2020-12-30 15:47:39.030 14512-14834/ D/AppsFlyer_6.1.0: Connecting to Install Referrer Library... 2020-12-30 15:47:39.031 14512-14834/ D/AppsFlyer_6.1.0: Connecting to Install Referrer Library... 2020-12-30 15:47:39.045 14512-14834/ D/AppsFlyer_6.1.0: Initializing AppsFlyer SDK: (v6.1.0.64) 2020-12-30 15:47:39.046 14512-14834/ I/AppsFlyer_6.1.0: Allowing multiple launches within a 5 second time window. 2020-12-30 15:47:39.047 14512-14512/ D/AppsFlyer_6.1.0: InstallReferrer connected 2020-12-30 15:47:39.048 14512-14834/ I/AppsFlyer_6.1.0: Starting AppsFlyer: (v6.1.0.64) 2020-12-30 15:47:39.048 14512-14834/ I/AppsFlyer_6.1.0: Build Number: 64 2020-12-30 15:47:39.049 14512-14902/ I/AppsFlyer_6.1.0: sendWithEvent from activity: android.app.Application 2020-12-30 15:47:39.050 14512-14834/ I/AppsFlyer_6.1.0: appsflyer_backup_rules.xml detected, using AppsFlyer defined backup rules for AppsFlyer SDK data 2020-12-30 15:47:39.054 14512-14902/ I/AppsFlyer_6.1.0: Trying to fetch GAID.. 2020-12-30 15:47:39.059 14512-14512/ D/AppsFlyer_6.1.0: Install Referrer collected locally 2020-12-30 15:47:39.059 14512-14512/ D/AppsFlyer_6.1.0: Install Referrer collected locally 2020-12-30 15:47:39.067 14512-14834/ V/Capacitor/Plugin: To native (Cordova plugin): callbackId: INVALID, service: CDVOrientation, action: screenOrientation, actionArgs: [3,"portrait"] 2020-12-30 15:47:39.068 14512-14834/ D/YoikScreenOrientation: execute action: screenOrientation 2020-12-30 15:47:39.068 14512-14834/ D/YoikScreenOrientation: Requested ScreenOrientation: portrait 2020-12-30 15:47:39.075 14512-14902/ W/m.Tamasha.smar: Unknown chunk type '200'. 2020-12-30 15:47:39.302 14512-14902/ I/AppsFlyer_6.1.0: * sendTrackingWithEvent: Launch 2020-12-30 15:47:39.319 14512-14902/ I/AppsFlyer_6.1.0: Found PreInstall property! 2020-12-30 15:47:39.398 14512-14902/ I/AppsFlyer_6.1.0: IMEI was not collected. 2020-12-30 15:47:39.402 14512-14902/ I/AppsFlyer_6.1.0: Android ID was not collected. 2020-12-30 15:47:39.403 14512-14902/ D/AppsFlyer_6.1.0: No OAID library 2020-12-30 15:47:39.427 14512-14902/ D/AppsFlyer_6.1.0: AppsFlyer: first launch detected 2020-12-30 15:47:39.428 14512-14902/ I/AppsFlyer_6.1.0: AppsFlyer: first launch date: 2020-12-30_101739+0000 2020-12-30 15:47:39.430 14512-14902/ W/AppsFlyer_6.1.0: Cannot verify existence of our InstanceID Listener Service in the manifest. Please refer to documentation. 2020-12-30 15:47:39.430 14512-14902/ D/AppsFlyer_6.1.0: didConfigureTokenRefreshService=false 2020-12-30 15:47:39.456 14512-14902/ I/AppsFlyer_6.1.0: AppsFlyerLib.sendWithEvent 2020-12-30 15:47:39.460 14512-14902/ D/AppsFlyer_6.1.0: Install referrer is allowed 2020-12-30 15:47:39.482 14512-14902/ W/m.Tamasha.smar: Accessing hidden method Landroid/app/ActivityThread;->currentApplication()Landroid/app/Application; (light greylist, reflection) 2020-12-30 15:47:39.508 14512-14902/ W/m.Tamasha.smar: Accessing hidden field Ldalvik/system/BaseDexClassLoader;->pathList:Ldalvik/system/DexPathList; (light greylist, reflection) 2020-12-30 15:47:39.508 14512-14902/ W/m.Tamasha.smar: Accessing hidden field Ldalvik/system/DexPathList;->nativeLibraryDirectories:Ljava/util/List; (light greylist, reflection) 2020-12-30 15:47:39.508 14512-14902/ W/m.Tamasha.smar: Accessing hidden field Ldalvik/system/DexPathList;->nativeLibraryPathElements:[Ldalvik/system/DexPathList$NativeLibraryElement; (light greylist, reflection) 2020-12-30 15:47:39.571 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: authguard canActivate 2020-12-30 15:47:39.573 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: authguard canActivate 2020-12-30 15:47:39.574 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: auth observable 2020-12-30 15:47:39.600 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: Auth Token from local storage:
2020-12-30 15:47:39.608 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: Auth Token from local storage:
2020-12-30 15:47:39.628 14512-14512/ I/chromium: [INFO:CONSOLE(0)] "An unknown error occurred when fetching the script.", source: (0) 2020-12-30 15:47:39.634 14512-14512/ E/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: Service worker registration failed with: TypeError: Failed to register a ServiceWorker for scope ('http://localhost/') with script ('http://localhost/ngsw-worker.js'): An unknown error occurred when fetching the script. 2020-12-30 15:47:39.657 14512-14778/ D/Capacitor: Handling local request: http://localhost/14-es2015.8d3c7d8d3f00fb282259.js 2020-12-30 15:47:39.697 14512-14778/ D/Capacitor: Handling local request: http://localhost/15-es2015.d6df050e5b047210ea4b.js 2020-12-30 15:47:39.927 14512-14902/ I/AppsFlyer_6.1.0: url: https://conversions.appsflyer.com/api/v6.1/androidevent?app_id=&buildnumber=6.1.0 2020-12-30 15:47:39.933 14512-14902/ I/AppsFlyer_6.1.0: data: {"country":"GB","af_timestamp":"1609323459237","appsflyerKey":"R****o","isFirstCall":"true","registeredUninstall":false,"operator":"airtel","isGaidWithGps":"true","app_version_code":"7","kef7d62":"ab12f94eda650bb248181a1b0c531a0d5918190d5a1f13","model":"Redmi Note 5 Pro","brand":"xiaomi","deviceType":"user","deviceData":{"cpu_abi":"arm64-v8a","build_display_id":"PKQ1.180904.001","btch":"usb","dim":{"size":"2","ydp":"403.411","xdp":"403.411","y_px":"2030","x_px":"1080","d_dpi":"440"},"arch":"","btl":"96.0","cpu_abi2":""},"exception_number":0,"disk":"16143\/51645","sdk":"28","fb":"6c494377-c0ce-42e4-b57f-c5c502630c40","app_version_name":"7.0","device":"whyred","cksm_v1":"3bf4bb23619e98e74f84b1f92ddf6f8f9c","rfr":{"val":"utm_source=google-play&utm_medium=organic","code":"0","clk":"0","install":"0","instant":false},"af_events_api":"1","cell":{"mnc":45,"mcc":404},"network":"MOBILE","timepassedsincelastlaunch":"-1","open_referrer":"","af_v2":"eebe1a632c74090d5ac220b73020d6a65222b875","sig":"FC289AB8A78FAEB00C8D2655FF4D4BF773E3B4A39DEB65B4448261BE9175F167","uid":"1609323459404-6577169956605500572","lang_code":"en","installDate":"2020-12-30_101728+0000","referrers":[{"api_ver":82313010,"referrer":"utm_source=google-play&utm_medium=organic","click_ts":0,"api_ver_name":"23.1.30-21 [0] [PR] 346929339","response":"OK","install_begin_ts":0,"google_custom":{"install_begin_server_ts":0,"install_version":null,"click_server_ts":0,"instant":false},"latency":29,"source":"google","type":"store"}],"firstLaunchDate":"2020-12-30_101739+0000","ivc":false,"lang":"English","batteryLevel":"96.0","last_boot_time":1608873918867,"product":"whyred","date2":"2020-12-30_154728+0530","counter":"1","date1":"2020-12-30_154728+0530","advertiserId":"6d4cefaa-c7f1-4de3-bf70-584d324bf1c7","advertiserIdEnabled":"true","af_v":"313275c34505706381996935d3ce8417e52b69ed","carrier":"IND airtel","af_preinstalled":"false","iaecounter":"0","sc_o":"p","tokenRefreshConfigured":false,"platformextension":"android_cordova"} 2020-12-30 15:47:40.616 14512-14769/ D/Capacitor: Handling local request: http://localhost/assets/images/Tamasha.gif 2020-12-30 15:47:42.129 14512-14512/ E/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: Backend returned code 401, body was: [object Object] 2020-12-30 15:47:42.131 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: Storage field does not exist: 2020-12-30 15:47:42.432 14512-14902/ I/AppsFlyer_6.1.0: response code: 404 2020-12-30 15:47:42.432 14512-14902/ D/AppsFlyer_6.1.0: [GCD-A01] Loading conversion data. Counter: 1 2020-12-30 15:47:42.446 14512-14920/ I/AppsFlyer_6.1.0: [GCD-B01] URL: https://gcdsdk.appsflyer.com/install_data/v4.0/?devkey=R****o&device_id=1609323459404-6577169956605500572 2020-12-30 15:47:42.584 14512-14778/ D/Capacitor: Handling local request: http://localhost/assets/images/logo.png 2020-12-30 15:47:42.712 14512-14597/ I/m.Tamasha.smar: ProcessProfilingInfo new_methods=4320 is saved saved_to_disk=1 resolve_classes_delay=8000 2020-12-30 15:47:43.694 14512-14920/ D/AppsFlyer_6.1.0: [GCD-A02] Calling onConversionFailure with: Error connection to server: 400 2020-12-30 15:47:43.695 14512-14920/ D/AppsFlyer_6.1.0: [GCD-A03] Server retrieving attempt finished 2020-12-30 15:47:43.699 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: ***** APPS FLYER **** 2020-12-30 15:47:43.700 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: Printing AppsFlyer Response: "{\"status\":\"failure\",\"type\":\"onInstallConversionFailure\",\"data\":\"Error connection to server: 400\"}" 2020-12-30 15:47:43.701 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: ================================== 2020-12-30 15:47:43.702 14512-14512/ I/Capacitor/Console: File: http://localhost/main-es2015.45bdbe86fcc32ca581e2.js - Line 1 - Msg: Printing Keys in Appsflyer Obj: status,type,data

amit-kremer93 commented 3 years ago

@yaseen-nadaf thank you for opening an issue. error code 400 indicates that your devkey might be incorrect, so please check it. do you use ionic-native AppsFlyer plugin? if yes, be sure you installing cordova plugin version 5.4.30, or just remove the ionic-native plugin and use the window object as mention here

yaseen-nadaf commented 3 years ago

actually the issue was my channel name in the dashboard and in my code were mismatching, so it wasn't working. Now that I have kept is same it's working fine. thank you.

usamadev17 commented 1 year ago

@yaseen-nadaf I'm facing the same issue. Can you please explain what the channel name you're taking about?

yaseen-nadaf commented 1 year ago

@usamadev17 in your AppsFlyer dashboard, you would be creating a project, where you will be specifying the channel name. That channel name and the channel name in your code should match.