我尝试使用Urban Airship PHP libraray实现深层链接消息传递,但我找不到文档或相关代码。 现在我有这个
require_once 'vendor/autoload.php';
use UrbanAirship\Airship;
use UrbanAirship\AirshipException;
use UrbanAirship\UALog;
use UrbanAirship\Push as P;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
$droidToken = "my-device-token" ;
UALog::setLogHandlers(array(new StreamHandler("php://stdout",Logger::INFO)));
$airship = new Airship("key", "Secret");
$req = $airship->push()
->setAudience(P\apid($droidToken))
->setMessage(P\message("This is the title",
"<html><body><h1>This is the message</h1></body></html>",
"text/html",
"utf-8",
array("value"=>"agh://myAppName.app/preferences23")))
->setDeviceTypes(P\all);
$response = $req->send();
其中agh://myAppName.app
是模板,preferences23
应该是值
我understand我需要将其添加到actions
标记中:
{
"actions": {
"open": {
"type": "deep_link",
"content": "prefs"
}
}
}
但在哪里?
当我运行上面的代码时,我会在手机中收到该消息,但是,消息中没有深层链接。
答案 0 :(得分:0)
action
type:
deep_link,
content:
是深层链接网址。
$req = $airship->push()
->setAudience(P\apid($deviceToken))
->setNotification(P\notification("my message',
array("actions" => array(
"open" => array(
"type" => "deep_link",
"content" => "js://myapp.app/deepLink"
)))))
->setDeviceTypes(P\all);