Netmera Developer Guide
Netmera Docs
  • Netmera Developer Guide
  • Platforms
    • iOS
      • New iOS (Swift)
        • SDK Integration
        • Push Notifications
          • Delegate Methods
          • Widget and In-App Messages
          • Media Push
          • Carousel, Slider and Thumbnail Push
        • Deep Linking
          • Custom Deep Links
        • Sound & Vibration
        • Push Inbox
        • Events
        • Geofence & Location
        • User Attributes & Preferences
        • Advertising ID
        • Changelog
      • Former iOS (Objective-C)
        • SDK Integration
        • Push Notifications
          • Delegate Methods
          • Push Payload Receivers
          • Widget and In-App Messages
          • Customizing In-App Messages
          • Media Push
          • Carousel, Slider and Thumbnail Push
          • Custom Web View Presentation
          • Push Icon
        • Live Activities
        • Deep Linking
          • Custom Deep Links
        • Sound & Vibration
        • Push Inbox
        • Events
        • Geofence & Location
        • User Attributes & Preferences
        • Data Transfer
        • Advertising ID
        • SSL Pinning
        • Changelog
    • Android
      • SDK Integration
        • Huawei Integration
        • Huawei Message Receipt
        • Android Integration FAQs
      • Push Notifications
        • Widget and In-App Messages
        • Push Callbacks
        • Custom Web View Presentation
        • Push Icon
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
        • Background Location Permission
      • User & Attributes
      • Data Transfer
      • Advertising ID
      • App Tracking
      • SSL Pinning
      • Changelog
    • Web
      • SDK Setup
        • Self-Hosted SDK Setup
      • Mobile Web Push for iOS
      • Deep Linking
        • Custom Deep Links
      • Events
      • User & Attributes
    • React Native
      • SDK Integration
      • Push Notifications
        • Widget and In-App Messages
        • Push Callbacks
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
      • User & Attributes
      • Changelog
    • Flutter
      • SDK Integration
      • Push Notifications
        • Push Notification Permissions
        • Widget and In-App Messages
        • Flutter iOS Media Push
      • Deep Linking
        • Custom Deep Links
      • Sound & Vibration
      • Push Inbox
      • Events
      • Geofence & Location
      • User & Attributes
      • SSL Pinning
      • Changelog
    • Cordova
      • SDK Integration
      • Push Notifications
      • Sound & Vibration
      • Push Inbox
      • Events
      • User & Attributes
    • Unity
      • SDK Integration
      • Sound & Vibration
      • Events
      • User & Attributes
      • Changelog
  • Integrated Modules
    • Optimove
    • Adjust
    • Mixpanel
    • IYS Integration
    • VIA Integration
      • Short URL Consent Requests
      • OTP Consent Requests
        • OTP Confirmation Completion
      • VIA Email Rejection Link Generation
      • ETK Rejection via SMS
  • API Documentation
    • REST API
      • Setup
      • Notifications
      • Events
      • User & Device Management
      • Inbox Feature
      • GDPR
      • Error Responses
  • FAQs
    • Push Notifications FAQs
Powered by GitBook
On this page
  • Q1: Build.gradle file error
  • Q2: Unresolved reference to version catalog
  • Q3: Netmera init error
  • Q4: Requesting push notification permissions
  • Q5: Checking if push notifications are enabled
  • Q6: FCM issues
  • Q7: HTTP v1 API
  • Q8: SenderId mismatch
  • Q9: com.google.android.gms.permission.AD_ID alert
  • Q10: Excluding Netmera Android SDK files from auto-backup if your app supports backup

Was this helpful?

  1. Platforms
  2. Android
  3. SDK Integration

Android Integration FAQs

PreviousHuawei Message ReceiptNextPush Notifications

Last updated 1 month ago

Was this helpful?

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

  • For more information, you may refer to this .

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 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);
}

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

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.

Q9: com.google.android.gms.permission.AD_ID alert

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.

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"
Stack Overflow answer