Android Integration FAQs
Q1: Build.gradle file error
I encountered an error while adding Netmera dependencies to the build.gradle file.
Error Message:
Problem occurred evaluating root project. Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle’
Navigate to
settings.gradle
and remove thedependencyResolutionManagement
block.For more information, you may refer to this Stack Overflow answer.
Q2: Unresolved reference to version catalog
While editing the gradle file in the Android SDK, I encountered the error "Unresolved reference to version catalog" after adding the necessary entries to the project gradle.
To resolve this issue, you can add the following two lines under the plugins
section in your libs.versions.toml
file:
google-services = { id = "com.google.gms.google-services", version = "4.3.8" }
#noinspection GradlePluginVersion
android-library = { id = "com.android.library", version = "1.9.0" }
After making these changes, the project should recognize the references, and the error should be resolved.
Q3: Netmera init error
I'm getting an error when initializing the Netmera SDK in the onCreate() method.
Error Message:
No method 'init' found
Ensure that you have correctly imported the Netmera SDK in your project.
Double-check the initialization code and make sure it matches the provided example.
Q4: Requesting push notification permissions
How do I request push notification permissions using the Netmera SDK?
Use the
requestNotificationPermissions(activity: Activity?)
method to trigger the necessary methods to send a request for permissions to the system.
Netmera.requestNotificationPermissions(this)
Netmera.requestNotificationPermissions(this);
Q5: Checking if push notifications are enabled
How can I check if push notifications are enabled for my application?
Use the
areNotificationsEnabled(): Boolean
method to check the notification status.
val isEnabled = Netmera.areNotificationsEnabled()
boolean isEnabled = Netmera.areNotificationsEnabled();
Q6: FCM issues
I'm encountering issues with Firebase Cloud Messaging alongside Netmera.
Make sure to call
onNetmeraPushMessageReceived(remoteMessage)
in your Firebase Messaging Service class when using Netmera alongside FCM.Update the FCM token by calling
onNetmeraNewToken(token)
in theonNewToken()
method.
override fun onMessageReceived(remoteMessage: RemoteMessage) {
if (Netmera.isNetmeraRemoteMessage(remoteMessage)) {
Netmera.onNetmeraPushMessageReceived(remoteMessage)
} else {
// other operations
}
}
override fun onNewToken(token: String) {
Netmera.onNetmeraNewToken(token)
}
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if (Netmera.isNetmeraRemoteMessage(remoteMessage)) {
Netmera.onNetmeraPushMessageReceived(remoteMessage);
} else {
// other operations
}
}
@Override
public void onNewToken(String token) {
Netmera.onNetmeraNewToken(token);
}
Q7: HTTP v1 API
Can I receive push notifications from the HTTP v1 API with my old token that I used to receive pushes with Legacy?
Yes, you can still receive push notifications from the HTTP v1 API with the same token that you used to receive notifications with the Legacy API. However, as long as your token is valid and properly formatted, you should be able to use it to receive notifications with the HTTP v1 API.
Q8: SenderId
mismatch
SenderId
mismatchWhat should I do if I receive a SenderId mismatch error when sending push notifications?
If you encounter a SenderId mismatch error, it indicates that your Sender ID is not mapped to the registration token you are targeting during the push notification sending process. Here are the possible reasons and solutions:
Wrong registration token used in the request:
Check if the registration token you're using was generated from the correct Project ID (Project Settings > General tab > Your project section) or Sender ID (Project Settings > Cloud Messaging tab > Project credentials section).
Wrong credential used to authorize the request:
Verify if the Server key you’re using matches the one found in the Firebase console (Project Settings > Cloud Messaging tab > Project credentials section).
Use the Instance ID API to verify the mapping:
It's recommended to use the Instance ID API to confirm the correct mapping of your Sender ID or auth key to your registration tokens.
Q9: com.google.android.gms.permission.AD_ID
alert
com.google.android.gms.permission.AD_ID
alertWhat should I do if I encounter the com.google.android.gms.permission.AD_ID alert during my application's App Store submission?
If you encounter the com.google.android.gms.permission.AD_ID alert during your application's App Store submission, follow these steps:
After proceeding with 'yes' to the alert, select the 'analytics' option on the subsequent page.
After this selection, there is no need for any additional additions to the manifest; merging the manifest is sufficient.
Q10: Excluding Netmera Android SDK files from auto-backup if your app supports backup
How can I exclude Netmera Android SDK files from auto-backup in my app?
Put the following rules into the corresponding files:
/res/xml/backup_rules.xml
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<exclude
domain="sharedpref"
path="53yotuierh_34_ds_dfjk.xml" />
<exclude
domain="database"
path="nm_req" />
</full-backup-content>
/res/xml/data_extraction_rules.xml
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<exclude
domain="sharedpref"
path="53yotuierh_34_ds_dfjk.xml" />
<exclude
domain="database"
path="nm_req" />
</cloud-backup>
<device-transfer>
<exclude
domain="sharedpref"
path="53yotuierh_34_ds_dfjk.xml" />
<exclude
domain="database"
path="nm_req" />
</device-transfer>
</data-extraction-rules>
In manifest application tag:
android:fullBackupContent="@xml/backup_rules"
android:dataExtractionRules="@xml/data_extraction_rules"
Last updated
Was this helpful?