我在我的应用程序中启用了推送通知,添加了构建提示,在play开发者控制台上注册了api,在我的服务器上创建并加载了Apple证书.当我在设备上测试应用程序时,它成功注册了推送通知.但是我的问题是尝试实际发送推送通知.我希望它通过PHP发送.我使用此代码直接从开发人员指南中获取.但是这不起作用......我的代码是问题还是我在启用推送通知过程中做错了什么.
<?php
include("config.php");
$args = http_build_query(array( 'certPassword' => 'XXXXXXXX', 'cert'
=>
'http://kyven.co.za/mibrand/certificate/XXXX.p12',
'production' => false,
'device' => null, 'packageName' => 'za.co.bonyelo.mibrand', 'email'
=>
'kyri88@gmail.com', 'type' => 1,
'auth' => 'XXXXXXXXXXXXXXXXXXXXXXXXXX',
'body' => 'Test'));
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content'
=> $args
) );
$context = stream_context_create($opts);
$response = file_get_contents("https://codename-
one.appspot.com/sendPushMessage", false, $context);
die(json_encode($response));
?>
Run Code Online (Sandbox Code Playgroud) 我有一个问题是在代号为inter的情况下拦截了android的urls.我使用构建提示ios.urlScheme和ios.plistInject让它适用于ios.我用于android的构建提示是:
android.xintent_filter=<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mibrand" /> </intent-filter>
Run Code Online (Sandbox Code Playgroud)
但是android没有将文本"mibrand:// ..."注册为链接,因此它只是纯文本,不能在任何Android设备上点击.我究竟做错了什么?
这是我的PHP代码
<?php
$store = $_GET['ref'];
$id = $_GET['id'];
$link1 = "mibrand://";
$link1 .= $store;
$link1 .= "/";
$link1 .= $id;
$link2 = "http://www.mibrandapp.com";
?>
<a href="<?php echo $link2 ?>"></a>
<a href="<?php echo $link1 ?>"></a>
Run Code Online (Sandbox Code Playgroud)
然后我将链接设置为分享到mylink/share.php?ref = store&id = 56
它也不适用于ios