Android上具有多个模块的Firebase推送通知 [英] Firebase push notifications on Android with multiple modules

查看:33
本文介绍了Android上具有多个模块的Firebase推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试在我们的应用程序中实现推送通知.

I'm currently trying to implement push notifications in our application.

所以我们有三个模块.

  • 应用1
  • 逻辑
  • 应用2

我给他们起了明显的名字.应用程序1和2对逻辑模块有依赖性.该模块包含两个应用程序的所有逻辑.现在,我希望向登录到App 1或App 2的用户发送App特定的通知.

I gave them obviously names. App 1 and 2 have a dependency on the logic module. This module contains ALL the logic for both apps. Now I want App specific notifications to users that are logged in on App 1 OR App 2.

问题:

我无法将firebase逻辑放入Logic模块中,因为此模块已配置为lib模块且未配置为App.现在,我必须将Firebase逻辑放在App 1和2中,但是由于App 1和2与Logic模块有依赖性,因此不能从Logic模块访问此逻辑.

I can't put the firebase logic into the Logic module since this module is configured as a lib module and isn't configured as an App. Now I have to put the firebase logic in App 1 and 2, but I can't access this logic from the Logic module since App 1 and 2 have a dependency on the Logic module and not the other way around.

Firebase每个连接的应用程序都需要一个google-services.json,此文件是生成用户特定的pushtoken所必需的.

Firebase requires a google-services.json for every app connected, this file is required to generate a user specific pushtoken.

是否可以配置它,以便为推送通知生成用户特定的令牌?因此,在用户登录后,必须根据App和用户生成一个pushtoken,以便该用户可以在他/她已登录的设备上获得通知.

Is there a way to configure this so that I can generate user specific tokens for push notifications? So after a user logs in a pushtoken has to be generated according to the App and user so this user can get a notifcation on said device which he/she is logged in.

我希望这很清楚.

推荐答案

应该没有什么可以阻止您实现所描述的内容.

There should be nothing stopping you from implementing what you're describing.

您仍然可以将Firebase SDK依赖项添加到库模块中.您只是不能在其上使用google-services插件-仅属于应用程序模块.

You can still add Firebase SDK dependencies to a library module. You just can't use the google-services plugin on it - that belongs only on application modules.

这篇关于Android上具有多个模块的Firebase推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆