我创建了一个使用GoogleCloudMessaging的应用程序.应用程序可以注册到gcm并将其注册ID存储到我的服务器上的数据库.我正在使用php,用于发送推送通知,但当谷歌将其发送到我的设备时,意图服务发现其消息类型为空.我在不同的应用程序中尝试了相同的代码并且运行良好.但这一次没有.该应用程序可以从谷歌获取消息并通过显示带有空文本的通知来处理它.我在下面提供了意图服务和php代码.谢谢你的回答.
send_message.php
<?php
if (isset($_GET["regId"]) && isset($_GET["message"])) {
$regId = $_GET["regId"];
$message = $_GET["message"];
include_once './GCM.php';
$gcm = new GCM();
$registatoin_ids = array($regId);
$message = array("price" => $message);
$result = $gcm->send_notification($registatoin_ids, $message);
echo $result;
}
?>
Run Code Online (Sandbox Code Playgroud)
GCM.php
<?php
class GCM {
//put your code here
// constructor
function __construct() {
}
/**
* Sending Push Notification
*/
public function send_notification($registatoin_ids, $message) {
// include config
include_once './config.php';
// Set POST variables
$url = 'https://android.googleapis.com/gcm/send';
$fields = array(
'registration_ids' => $registatoin_ids, …Run Code Online (Sandbox Code Playgroud) null android push-notification message-type google-cloud-messaging
我是C#.Net的新手,我有一个问题,我无法在互联网上找到.我何时应该使用html + javascript + css的经典组合,而不是使用带有代码的aspx页面?正如我从.net开始经历的那样,我发现aspx页面和代码背后对开发人员来说非常容易.自从我开始以来,我不需要任何javascript代码.一定有什么不对劲.我想我错过了一点.你能否回答我的问题并告诉我一些例子,我必须使用html + javascript + css而不是aspx + aspx.cs,反之亦然?祝你今天愉快.
我刚开始使用c#和asp.net在visual studio开发Web应用程序.在我的一个页面中,我将文本框的文本值设置为某个值.用户可以更改文本并保存.单击保存按钮,我必须从文本框中获取新的文本值,但我总是得到第一个文本集.如果你帮助我,我会很高兴的.
我试图在我的一个页面中打印一个div但是我不能在打印时应用css.在样式标签内写入media ="print"不起作用.我该怎么办?
<style type="text/css" media="print">
body
{
font-size:medium;
color:Black;
font-size:14px;
}
input
{
margin:0px;
font-size:14px;
}
.grid
{
border-color:Gray;
border-width:1px;
}
.alan
{
border-style:none;
}
.grid1
{
border-color:Gray;
border-width:1px;
}
</style>
Run Code Online (Sandbox Code Playgroud) asp.net ×2
c# ×2
javascript ×2
.net ×1
android ×1
code-behind ×1
css ×1
html ×1
jquery ×1
media ×1
message-type ×1
null ×1
printing ×1
save ×1
textbox ×1