我试图用Postman将POST发送到firebase,但是我有一个错误:
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
Run Code Online (Sandbox Code Playgroud)
这是我的身体和标题.对于授权我不确定,我把我的ios firebase项目的api服务器密钥.我想发送它并在我的设备上显示通知.
感谢您的帮助.
当我使用xcode启动应用程序时,我无法确定APNS,但最终:连接到FCM.
<FIRAnalytics/INFO> Firebase Analytics v.3200000 started
2016-08-25 07:58:06.690 HelloCordova[2426:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2016-08-25 07:58:06.741 HelloCordova[2426:671139] Firebase Crash Reporting: Successfully enabled
2016-08-25 07:58:06.754: <FIRInstanceID/WARNING> FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2016-08-25 07:58:06.755: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid …Run Code Online (Sandbox Code Playgroud) push-notification ios firebase postman firebase-cloud-messaging
我正在使用firebase消息传递服务进行消息传递和通知.我似乎无法将传入的消息从服务传递到适配器,以便在收到消息时可以将其插入到RecycleView列表中.
我尝试使用BroacastIntent如下:
public class messaging extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage m) {
store(m.getData());
broadcastIntent();
}
public void broadcastIntent() {
Intent intent = new Intent();
intent.setAction("com.myApp.CUSTOM_EVENT");
sendBroadcast(intent);
}
}
Run Code Online (Sandbox Code Playgroud)
并在Adpter
public class ConvoAdapter extends RecyclerView.Adapter<ConvoHolder> {
private List<Message> list;
private Activity A;
public ConvoAdapter(List<Message> data) {
}
@Override
public ConvoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(layout, parent, false);
return new ConvoHolder(v);
}
@Override
public void onBindViewHolder(ConvoHolder h, int Position) {
final Message M = list.get(Position);
h.config(A, …Run Code Online (Sandbox Code Playgroud) 我遇到了崩溃:
Fatal Exception: java.lang.SecurityException: !@Too many alarms (500) registered from pid 27251 uid 11383
at android.os.Parcel.readException(Parcel.java:1620)
at android.os.Parcel.readException(Parcel.java:1573)
at android.app.IAlarmManager$Stub$Proxy.set(IAlarmManager.java:217)
at android.app.AlarmManager.setImpl(AlarmManager.java:484)
at android.app.AlarmManager.set(AlarmManager.java:260)
at com.google.firebase.iid.FirebaseInstanceIdService.zzagl(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zzd(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zza(Unknown Source)
at com.google.firebase.iid.FirebaseInstanceIdService.zzm(Unknown Source)
at com.google.firebase.iid.zzb$2.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Run Code Online (Sandbox Code Playgroud)
正如您所见,崩溃是在Firebase库中.我读了其他的答案,但所有这些都是关于代码中的警报的使用,就像这个.我只使用Firebase库进行消息,分析和远程配置.
compile "com.google.firebase:firebase-core:$firebaseLibVersion"
compile "com.google.firebase:firebase-config:$firebaseLibVersion"
compile "com.google.firebase:firebase-messaging:$firebaseLibVersion"
ext {
firebaseLibVersion = '9.6.1'
}
Run Code Online (Sandbox Code Playgroud)
正如预期的那样,问题只发生在三星设备上.所以,我知道为什么它会在三星设备上发生,但我不知道如何修复它.
我需要用于静默通知的通知有效负载示例,我在下面的结构中尝试了此方法,但是它不起作用
{
"notification" : {
"body" : " Survey list updated",
"content-available:" : true,
"data" : {
"isNewUpdateAvailable" : "easysurvey.survey_list_updated"
}
},
"to" : "f6PwToRUxk0:APA91bG7bSWoKsjHXVmXaiDEnFXA2x2jEOMSO6eGCqPv1fRd-dctNLDEabRq-0So_obuPGFqOFTSLJl5FFyuOuXKBXh-n89BmzzXenRTxoirY9Y1c6-J9MxpDp0ojHL2xm1law0V6gg3"
}
Run Code Online (Sandbox Code Playgroud)
使用此结构,我可以接收通知,但它不是静音的,不会唤醒应用程序。我需要Firebase通知的解决方案,并且在iOS 10上,我遵循的是相同的Firebase示例代码
apple-push-notifications ios firebase firebase-cloud-messaging ios10
我正在尝试将通知实施到我的Web应用程序中。我有这个php文件,我在其中发送通知:
<?php
function sendGCM($title,$message, $id) {
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array (
'registration_ids' => array (
$id
),
"notification" => array(
"title" => $title,
"body" => $message,
"click_action" => "https://google.com"
)
);
$fields = json_encode ( $fields );
$headers = array (
'Authorization: key=' . $MY_KEY,
'Content-Type: application/json'
);
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_URL, $url );
curl_setopt ( $ch, CURLOPT_POST, true );
curl_setopt ( $ch, CURLOPT_HTTPHEADER, $headers );
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt ( …Run Code Online (Sandbox Code Playgroud) 我正在使用Xamarin创建一个简单的Android应用程序,该应用程序从Firebase Cloud Messaging接收推送通知.
我遵循Xamarin的文档来实现这个功能.
然后一步一步地跟着它,直到看到以下部分:
我点击了Log Token Button并收到了令牌.
在接下来的步骤是从火力地堡控制台发送通知,但通知不会继续执行仿真器发送之后并记录在火力地堡也不是Xamarin控制台没有错误.
Firebase控制台将消息显示为"已完成".
我错过了什么来解决这个问题?
什么是笔者的推动https://github.com/firebase/functions-samples/blob/master/fcm-notifications/functions/index.js 74号线使用传统的API?
换句话说,是否可以使用Firebase FCM 非传统API达到相同的结果?
我正在使用Firebase Cloud Messaging将通知发送到我的Flutter应用。它工作正常,但我的应用程序图标通知在Google Pixel XL上为灰色。我可以看到轮廓,但是由于某种原因,它仍然是灰色的。我读过不同的文章,它与Android SDK级别有关,但是Flutter中的minSdkVersion已经是16(小于21),所以我不明白为什么颜色不会显示。
那么可以用颜色显示我的应用程序图标以进行通知吗?
- 提前致谢
android push-notification firebase flutter firebase-cloud-messaging
我登录的Android客户端在我的服务器上注册其令牌。问题是我不确定特定客户端发送的令牌是否真正属于该客户端用户ID。错误的客户端可能会注册其他用户的有效令牌。
给定FCM令牌和用户ID,服务器上的管理员代码如何验证该令牌确实属于(经过身份验证的)用户ID?
android firebase firebase-authentication firebase-cloud-messaging firebase-admin
我正在尝试通过重新创建成功的Firebase控制台帖子的输出来通过CFHTTP正确编码对Firebase Cloud Messaging REST API的调用。以下是控制台指出的正确代码
POST /fcm/send HTTP/1.1
Host: fcm.googleapis.com
Content-Type: application/json
Authorization: key=AIzcXE
cache-control: no-cache
{
"to": "e5kpn8h9bR95NuXVHTOi50bCURG0BS4S6ccUm3X5q",
"priority": "high",
"notification" : {
"title": "",
"body" : "This is the actual message content",
"sound": "default",
"image": "https://gladevalleyanimalhospital.net/wp-content/uploads/2017/03/raster-7.png"
}
}
Run Code Online (Sandbox Code Playgroud)
这是我们当前的CFHTTP代码:
<cfhttp method="Post" url="https://fcm.googleapis.com/fcm/send">
<cfhttpparam type="header" name="Authorization" value="key=AIzXE">
<cfhttpparam type="header" name="Content-Type" value="application/json">
<cfhttpparam type="header" name="Postman-Token" value="e19b8abf3f9">
<cfhttpparam type="header" name="cache-control" value="no-cache">
<cfhttpparam type="Formfield" value="3569D24982E3B" name="to">
<cfhttpparam type="Formfield" value="high" name="priority">
<cfhttpparam type="Formfield" value="Test" name="title">
<cfhttpparam type="Formfield" value="This is the actual message content" …Run Code Online (Sandbox Code Playgroud)