Skip to content

Conversation

@jpike88
Copy link
Contributor

@jpike88 jpike88 commented Feb 13, 2025

fixes #87

@stewones
Copy link
Member

These changes look good to me. Unfortunately, I'm unable to test Android.

Are you cool with these @jcesarmobile ?

@jpike88

This comment was marked as abuse.

@jcesarmobile
Copy link
Contributor

The plugin never had firebase notifications implemented, it had a dependency to firebase messaging, but no code.
I removed the dependency because it was causing issues since it was using a fixed version.
The docs mention @capacitor/push-notifications should be used, if this gets merged then it will interfere with @capacitor/push-notifications push message handling, so probably shouldn't be used anymore and should in fact recommend not using it as it would cause issues. But then what about iOS? this PR only implements Android.

Anyway, I don't have experience with intercom, so it's up to you what you merge and what not.

@stewones
Copy link
Member

@jpike88

why you can't use @capacitor/push-notifications ?

jcesar is right, we should not pin firebase messaging dependencies here.

@jpike88
Copy link
Contributor Author

jpike88 commented Jun 21, 2025

I do use @capacitor/push-notifications, that's the problem. It somehow overrides or cancels out the intercom's plugin push receiving functionality for contacting our customers.

#87 (comment)

I didn't just make this PR for fun, I made it because this repo does not work. My fix makes it work.

Up to you guys but I have no reason to move back to main repo when it's literally broken for me.

@stewones stewones self-assigned this Jun 21, 2025
@stewones stewones self-requested a review June 21, 2025 18:21
Copy link
Member

@stewones stewones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to force external dependencies in plugins unless strictly necessary. Additionally, adding Firebase Messaging for Android only would break interoperability with iOS.

I hope my comments help you implement your app in a balanced way, where it fixes your issues while still using this plugin.

androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation "io.intercom.android:intercom-sdk:$intercomSdkVersion"
implementation "com.google.firebase:firebase-messaging:$firebaseMessagingVersion"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jpike88 have you tried defining the firebase-messaging dep in your app's build.gradle instead ?

@@ -1,5 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
>
<application>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, you should be able to define this in your app layer, not in the plugin.

@@ -0,0 +1,29 @@
package com.getcapacitor.community.intercom.intercom;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this MessagingService could be implemented in the MainActivity if using the app's AndroidManifest

String apiKey = config.getPluginConfiguration("Intercom").getString("androidApiKey");
String appId = config.getPluginConfiguration("Intercom").getString("androidAppId");

switch (IntercomPushManager.getInstalledModuleType()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this part as I can't test. but do we really need to tell Intercom to cache a sender id? if so, something to investigate and move to the app layer as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Push notifications not working for Android

3 participants