我正在尝试触发我的 Android 应用程序来接收简单的推送消息。我想用cURL. 我尝试遵循文档 ,但收到 401...这曾经有效,有什么变化吗?
我使用以下代码检索了我的设备令牌:
FirebaseMessaging.getInstance().token.addOnSuccessListener { token: String ->
if (!TextUtils.isEmpty(token)) {
Log.d("TAG", "retrieve token successful : $token")
} else {
Log.w("TAG", "token should not be null...")
}
}.addOnFailureListener { e: Exception? -> }.addOnCanceledListener {}
.addOnCompleteListener { task: Task<String> ->
Log.v("TAG", "This is the token : " + task.result)
}
Run Code Online (Sandbox Code Playgroud)
我的卷曲代码:
curl -X POST -H "Authorization: Bearer AAAArxt...CelsCl" -H "Content-Type: application/json" -d '{
"message":{
"notification":{ …Run Code Online (Sandbox Code Playgroud)