Php 将卷曲转换为改装功能(GCM通知推送)
我试图将我的cURL for GCM通知推送转换为改装功能,但我不知道具体如何转换。 我的卷发看起来像这样:Php 将卷曲转换为改装功能(GCM通知推送),php,android,curl,google-cloud-messaging,retrofit,Php,Android,Curl,Google Cloud Messaging,Retrofit,我试图将我的cURL for GCM通知推送转换为改装功能,但我不知道具体如何转换。 我的卷发看起来像这样: curl --header "Authorization: key=KKK" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"XXX\"]}" 其中KKK=key,XXX=userRegistrationToken
curl --header "Authorization: key=KKK" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{\"registration_ids\":[\"XXX\"]}"
其中KKK=key,XXX=userRegistrationToken
我错过了那个里的信息,因为我并没有找到如何做到这一点,但总的来说,这个旋度是有效的。我想做完全相同的事情,但与(通知)消息
我试着得到了这样的结果:
//GCM_ENDPOINT = "https://android.googleapis.com";
@FormUrlEncoded
@POST("/gcm/send")
void sendNotification(
@Header("Authorization") String key,
@Header("Content-Type") String contentType,
@Field("message") String message,
Callback<Object> response);
TypedInput requestBody = new TypedByteArray("application/json", jsonString.getBytes(Charset.forName("UTF-8")));
//GCM\u端点=”https://android.googleapis.com";
@FormUrlEncoded
@POST(“/gcm/send”)
无效发送通知(
@标题(“授权”)字符串键,
@标题(“内容类型”)字符串contentType,
@字段(“消息”)字符串消息,
回调响应);
我不知道到目前为止这是否正确,但是它缺少我想要发送的通知消息,我甚至不知道如何处理这个-d注册\u id,尤其是当我想在那里放置一些id时。提前感谢。好的,我设法找到了一个解决方案,即使不是直接转换旋度,它也能完美地工作:
@POST("/gcm/send")
@Headers({"Content-Type: application/json"})
void sendNotification(
@Header("Authorization") String apiKey,
@Body TypedInput jsonBodyInput,
Callback<NotificationResult> response);
jsonString的外观如何