【问题标题】:How to use Urban Airship Deep link with PHP如何在 PHP 中使用 Urban Airship Deep 链接
【发布时间】:2015-12-28 11:43:47
【问题描述】:

我正在尝试使用 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"
      }
   }
}

但是在哪里?

当我运行上面的代码时,我在手机中收到了消息,但是消息中没有深层链接。

【问题讨论】:

    标签: php push-notification apple-push-notifications deep-linking urbanairship.com


    【解决方案1】:

    找到了! 你只需要在通知结构中添加一个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);
    

    【讨论】:

    • 从哪里可以找到它“js://myapp.app/deepLink”?
    • 从哪里可以找到内容密钥的深层链接 url?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-08-16
    • 2012-12-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多