onesignal 和其他推送通知服务如何在没有 json 配置文件的情况下工作?

how does onesignal and other push notification services work without json configuration file?

嘿,我对我们使用 onesignal 设置通知服务的方式很感兴趣,但我知道如果应用程序使用 firebase 发送通知,它需要一个 json 配置文件。

这里是a link

那么 onesignal android sdk 如何初始化应用程序以接收来自 fcm 或 gcm 的通知?

Firebase 的 json 配置文件只是为了简化您的任务。您可以随时从代码初始化您的 Firebase 应用程序,但这涉及一些编码。 Android Studio 由 Google 开发,Firebase 由 Google 开发,因此最好通过包含一个 google-services.json 和一个 google-服务插件。就这么简单。

您可以使用以下代码初始化 Firebase:

FirebaseApp.initializeApp(context, new FirebaseOptions.Builder().setApiKey("<VAL>").
                setApplicationId("<VAL>").
                setDatabaseUrl("<VAL>").
                setGcmSenderId("<VAL>").
                setStorageBucket("<VAL>").build());  

FirebaseInitProvider 为您完成同样的任务

来源:Link