I’m trying to add notifications in my game that will update automatically when a new blog post is published. Is there a way to do this? I’m fairly new to web integration, so explain it to me like I’m a four-year-old. I don’t exactly need an entire script for this, just an explanation with examples. Thanks.
You may use a constant polling:
void Start() {
StartCoroutine(StartBlogMonitoring());
}
IEnumerator StartBlogMonitoring() {
while (true) {
var rq = new WWW("http://myblog.com/blogposts-list");
yield return rq;
var list = Parse(rq.text);
if (HasNewPost(list))
{
PushNotification();
}
yield return new WaitForSeconds(2);
}
}
It will send a request to a blog site every 2 seconds to retrieve posts list, then check for a new post there and create notification. Instead of posts list, you can use whatever way is appropriate for your blog to check for new posts.