PHP web sitesinden iOS ve Android'e nasıl push bildirimi gönderebilirim?

Aug 28 2020

PHP web sitesinden iOS cihazlara ve Android cihazlara nasıl push bildirimi gönderebilirim?

Bunun için herhangi bir öğretici var mı?

Yanıtlar

1 MuhammadZubair Aug 28 2020 at 11:12

Firebase Messaging, One Signal gibi push bildirimleri için önceden hazırlanmış çeşitli hizmetleri kullanabilirsiniz. PHP ile Firebase bulut Mesajlaşma Entegrasyonu için lütfen bu Bağlantıyı ziyaret edin . Kurulumdan sonra, bu POST isteğini kullanıcı jetonuyla göndermeniz yeterlidir.

POST https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send HTTP/1.1

Content-Type: application/json
Authorization: Bearer ya29.ElqKBGN2Ri_Uz...PbJ_uNasm

{
  "message": {
    "token" : <token of destination app>,
    "notification": {
      "title": "FCM Message",
      "body": "This is a message from FCM"
    },
    "webpush": {
      "headers": {
        "Urgency": "high"
      },
      "notification": {
        "body": "This is a message from FCM to web",
        "requireInteraction": "true",
        "badge": "/badge-icon.png"
      }
    }
  }
}

veya konuyu kullanarak Push Bildirimi gönder

https://fcm.googleapis.com//v1/projects/<YOUR-PROJECT-ID>/messages:send
Content-Type: application/json
Authorization: bearer <YOUR-ACCESS-TOKEN>

{
  "message": {
    "topic": "matchday"
    "notification": {
      "title": "Background Message Title",
      "body": "Background message body"
    },
    "webpush": {
      "fcm_options": {
        "link": "https://dummypage.com"
      }
    }
  }
}

Tek Sinyal için, daha fazla bilgi için bu Bağlantıyı ziyaret edin . Ayrıca, önceden hazırlanmış hizmetler istemiyorsanız, alternatif olarak web soketlerini de kullanabilirsiniz.