android - FCM Invalid topic name on base64 topic
问题描述
When I subscribe to a base64 (no padding) topic from my android app I get this exception
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=321, result=0, data=null} to activity {com.example/com.example.view.activity.MainActivity}:
java.lang.IllegalArgumentException: Invalid topic name: aHR0cDovL3d3dy5iYmMuY28udWsvbmV3cy8
does not match the allowed format [a-zA-Z0-9-_.~%]{1,900}
The topic name is supposed to pass the given exp so I don't know why I get this exception, also the topic doesn't exist yet. The console confirms that no topics exist yet, but when I send a message to the said topic it appears as completed.From the app I can subscribe to topics like "afsfsfsggg" .
Sending a message from the Admin SDK gives this response but no entries in the console:
projects/project-id/messages/5312412342391596688
解决方案
问题是换行符“\n”。
topic.replace("\n", "");
推荐阅读
- php - 商店软件/开发 Docker 映像从何而来?
- android - 在通知生成器android中将颜色设置为图标
- c# - 在没有忙等待的情况下,我如何等待直到收到回调/通知?
- realm - 在 Yarn 安装中,Realm js 经常出错
- python - pytorch:LSTM 输入和输出维度和训练循环
- reactjs - 可以使用 Axios 模拟来自外部库的 API 调用吗?
- c - 为什么我可以释放结构的一部分它释放所有结构
- c - 我写的 Bcrypt 实现返回正确的成本和盐,但加密的消息不正确
- azure - Dynamics 365 和 Azure 事件中心集成
- python - Python:如何通过被另一个字符串列表分割的子字符串创建一个列表?