-
Notifications
You must be signed in to change notification settings - Fork 27
Shicheng/fence 2369 campaigns support additional metadata with deep linking #456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,27 @@ | ||||||||||||||||||||
| package io.radar.example | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import android.app.Activity | ||||||||||||||||||||
| import android.app.Application | ||||||||||||||||||||
| import android.os.Bundle | ||||||||||||||||||||
| import android.util.Log | ||||||||||||||||||||
| import org.json.JSONObject | ||||||||||||||||||||
|
|
||||||||||||||||||||
| class MyActivityLifecycleCallbacks : Application.ActivityLifecycleCallbacks { | ||||||||||||||||||||
| override fun onActivityResumed(activity: Activity) { | ||||||||||||||||||||
| // Your custom logic. E.g. tracking, analytics, session checks, etc. | ||||||||||||||||||||
| Log.d("MyLifecycle", "onActivityResumed, Intent metadata: " + activity.intent.getStringExtra("radar_campaign_metadata")) | ||||||||||||||||||||
|
|
||||||||||||||||||||
| val campaignMetadata = try { | ||||||||||||||||||||
| activity.intent.getStringExtra("radar_campaign_metadata")?.let { JSONObject(it) } | ||||||||||||||||||||
|
||||||||||||||||||||
| activity.intent.getStringExtra("radar_campaign_metadata")?.let { JSONObject(it) } | |
| import io.radar.example.RadarNotificationHelper | |
| class MyActivityLifecycleCallbacks : Application.ActivityLifecycleCallbacks { | |
| override fun onActivityResumed(activity: Activity) { | |
| // Your custom logic. E.g. tracking, analytics, session checks, etc. | |
| Log.d("MyLifecycle", "onActivityResumed, Intent metadata: " + activity.intent.getStringExtra(RadarNotificationHelper.RADAR_CAMPAIGN_METADATA)) | |
| val campaignMetadata = try { | |
| activity.intent.getStringExtra(RadarNotificationHelper.RADAR_CAMPAIGN_METADATA)?.let { JSONObject(it) } |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -19,6 +19,7 @@ class MyRadarReceiver : RadarReceiver() { | |||
| var identifier = 0 | ||||
|
|
||||
| internal fun notify(context: Context, body: String) { | ||||
| return; | ||||
|
||||
| return; |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,15 +10,16 @@ import android.content.Intent | |||||||||||
| import android.graphics.Color | ||||||||||||
| import android.net.Uri | ||||||||||||
| import android.os.Build | ||||||||||||
| import android.util.Log | ||||||||||||
|
||||||||||||
| import android.util.Log |
ShiCheng-Lu marked this conversation as resolved.
Show resolved
Hide resolved
Copilot
AI
Aug 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code now unconditionally sets intent data and action even when deeplinkURL might be null or empty. This could cause issues with Uri.parse() if deeplinkURL is null. The previous null check should be retained.
| action = Intent.ACTION_VIEW | |
| if (!deeplinkURL.isNullOrEmpty()) { | |
| data = Uri.parse(deeplinkURL) | |
| action = Intent.ACTION_VIEW | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extra key used here ("radar_campaign_metadata") doesn't match the constant defined in RadarNotificationHelper ("RADAR_CAMPAIGN_METADATA"). This inconsistency will prevent the metadata from being retrieved correctly.