Closed afarhan39 closed 2 years ago
Hi @afarhan39 . can you please do the following:
@afarhan39 If you are still facing the issue, please feel free to reopen this with the info asked. Thanks!
verify if you added the whole name of the activity(i.e package+activity name) or just the class name, in the manifest?
@darshanclevertap What should be used, with package name or without?
@walaankit To exclude in-app from any specified activity, you need to specify only the activity name. More info regarding the same can be found here
@william-ct I spent a lot of time to debugging and found the following - you need to specify the full name of the activity
@AkimovAN
you need to specify the full name of the activity
How did you conclude the above result from the sample you've shared? In the screenshot, you're blacklisted activity is StartActivity
and your current activity ui.activities.SplashScreenActivity
, in this specific case canShowInAppOnActivity()
will return true.
Also if you can see line 343 we get the local class name from CoreMetaData.getCurrentActivityName()
and does a contains check with blackListedActivity
string value. So if it(blackListedActivity
) has the entire ActivityName/getLocalClassName(package_activityName) or only the activityName/getSimpleClassName(activityName), canShowInAppOnActivity()
method will return false when currentActivityName
contains blackListedActivity
string value.
@walaankit Do let us know here if it has solved your issue.Thanks
@william-ct Ignore the activity names from the screenshot - I only show that if you specify the only activity name in the manifest, then this name will be added to the inappActivityExclude list, while CoreMetaData.getCurrentActivityName() returns the full name of the activity, including package name. This is what I was trying to show in the screenshot
@AkimovAN So if you specify only activityName or activityName(including the package) in the manifest, then in-app notification will always be excluded/not shown in the specified activity.
@william-ct No, that's what I'm talking about. If you add the only activity name ("TestActivity") to the manifest, then the list (inappActivityExclude) will store "TestActivity", while CoreMetaData.getCurrentActivityName() will return "com.your.company.name.TestActivity" and check will fail
@william-ct Sorry, I mistyped the list name a bit. Of course, we were talking about the "blackListedActivity" list. But everything else is correct. I debugged it again with activity name in the manifest "android:value="SplashScreenActivity""
@AkimovAN Ok, from your above sample, the following code will have
for (String blacklistedActivity : inappActivityExclude) {
String currentActivityName = CoreMetaData.getCurrentActivityName();
if (currentActivityName != null && currentActivityName.contains(blacklistedActivity)) {
return false;
}
}
blacklistedActivity
string which has TestActivity
whereas currentActivityName
string has com.your.company.name.TestActivity
, which is correct. The condition will be true or it will not fail because currentActivityName
is not null AND currentActivityName
contains blacklistedActivity
string.
@william-ct You are absolutely right, I understood what was wrong, thank you very much for your answers
Describe the bug In App Notifications does not obey CLEVERTAP_INAPP_EXCLUDE tag despite added correct Activity to exclude.
To Reproduce Steps to reproduce the behavior:
Expected behavior I'm expecting In App Notification to be shown in HomeActivity, instead of SplashActivity.
Screenshots/Logs Please see attached video. InAppVid.webm
Environment (please complete the following information):
Additional context