Facebook SDK / App Events / Android >> Test page won't work

21 hours ago 4
ARTICLE AD BOX

This question is about using the Facebook SDK to enable App Events for my Android app. Meta has a "test" page where you can -- supposedly -- test your app in real time and ensure your setup is correct and Meta receives events from your app. The said Meta console is at the Events Manager (if you have a business account with Meta). Select Datasets, then your Meta app, and finally the Test Events tab on the right. It doesn't work for me - nothing shows.

I get (delayed) data in the Overview tab, so I know it's connected; but it'd be really nice if that Events page were to work as advertised. Please see 2 screenshots below.

Code

Here's the pertinent parts in the manifest: first, the declarations in the application section, and then the permissions below:

... <!-- Meta (Facebook) advertising hook --> <!-- Why tools:replace: name duplication with Firebase auth via Facebook --> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" tools:replace="android:value"/> <meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/> <meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="true"/> <meta-data android:name="com.facebook.sdk.AdvertiserIDCollectionEnabled" android:value="true" /> </application> <!-- Meta needs these --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="com.google.android.gms.permission.AD_ID" />

This is a single-activity app, here's Main:

override fun onResume() { super.onResume() ... // Meta (Facebook) advertising hook AppEventsLogger.activateApp(this.application) ...

Here's a fragment that generates a request:

class HomeFragment : Fragment() { ... // Meta (Facebook) events logger for ads; Gemini wants it here, not in the helper private lateinit var metaLogger: AppEventsLogger ... override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle? ): View { ... metaLogger = AppEventsLogger.newLogger(requireContext()) ... binding.homeButtonAddAccounts.setOnClickListener { ... // report to Meta ads FacebookHelper.logAddAccount(metaLogger, "HomeFragment") }

Finally, the helper (yes, I see the Timber in the logcat)

fun logAddAccount(logger: AppEventsLogger, caller: String) { val params = Bundle().apply { putString("button_name", "add_accounts") putString("screen_origin", caller) } logger.logEvent("button_add_account", params) // my own event -- works? logger.logEvent(AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT) Timber.d("META: Logged add accounts button click.") }
Read Entire Article