Android Integration FAQs

Q1: 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 the dependencyResolutionManagement block.

  • For more information, you may refer to this Stack Overflow answer.


Q2: 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.


Q3: 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);

Q4: 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();

Q5: 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 the onNewToken() 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);
}

Q6: 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.


Q7: What 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.


Q8: What 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.

Last updated