- Home /
Update Notification
Hi all, i need to give the update notification like clash of clans. They give the notification for game updates like that i want. Any ideas? am using android platform.
Answer by NoseKills · Jan 10, 2015 at 06:31 PM
In Clash of Clans (just like any other "always connected" game) the update notifications are triggered when the client connects to the game server. Then based on whatever rules the developers decide they want, they can have the client app show that notification: if client notices the server version is newer than client version, if the server sends a specific message telling the client to show it...
The client itself can't know of any updates. You need to have a url/server from which you can make the client check the newest version from, and where you can update the required version number when you make a new release.
If you have a URL where you can maintain a text file with the newest version number, you could make your app just download that file and parse the version number from it and then show a notification if needed.
Just remember that you should update the version file only after the new client version is actually available on Google Play. It can take hours after uploading an APK for it to become available.
So, may i add the version update using by my assetbundle?
If I understand what you mean correctly, yes. If you have a place where you host asset bundles that your app downloads and uses, those bundles could contain for example a text file with the latest compatible version number. If the client knows it's own version number too, it can then compare those two and show the notification when needed.
Okay, thanks but i don't know how to do this with my asset bundle here is my assetbundle, yes an i have a version number too. Can you please tell me how to do that or do you know any link for learning this, because i tried many link they used some 10 lines code for that, i didn't what it's contained.
using UnityEngine;
using System.Collections;
public class BundleLoad : $$anonymous$$onoBehaviour
{
private string progress = " ";
private string logtxt;
private string url = "$$anonymous$$y_Url_Link";
GUIStyle Font_Size;
void Awake()
{
Font_Size = new GUIStyle ();
Font_Size.fontSize = 40;
Font_Size.normal.textColor = Color.black;
}
void log( string t )
{
logtxt += t + "/n";
}
void OnGUI()
{
Vector3 scale;
float ResolutionX = 1024;
float ResolutionY = 768;
scale.x = (float)Screen.width/ResolutionX;
scale.y = (float)Screen.height/ResolutionY;
scale.z = 1;
$$anonymous$$atrix4x4 sv$$anonymous$$at = GUI.matrix;
GUI.matrix = $$anonymous$$atrix4x4.TRS(new Vector3(0,0,0),Quaternion.identity,scale);
GUI.Label (new Rect (560, 684, Screen.width - 5, Screen.height - 5), "Downloading: ", Font_Size);
GUI.Label (new Rect(795, 684, Screen.width - 5, Screen.height - 5), logtxt + " " + progress, Font_Size);
}
IEnumerator Start()
{
using(WWW www = WWW.LoadFromCacheOrDownload (url, 1))
{
while( !www.isDone )
{
progress = " " + (www.progress * 100.0f).ToString("#") + " %";
yield return null;
}
yield return www;
AssetBundle bundle = www.assetBundle;
bundle.LoadAll();
Application.LoadLevel("$$anonymous$$ain_$$anonymous$$enu");
}
}
}
I actually haven't used asset bundles myself, but looking at this example i think you should be able to just have a TextAsset or a GameObject with a "Versioin Script" attached to it in your bundle and load it from there.
AssetBundleRequest request = bundle.LoadAsync ("versionObject", typeof(GameObject));
You are using
bundle.LoadAll();
and it returns an Object[]. I don't know how to find the desired object from it but you should be able to do that too.
Your answer
Follow this Question
Related Questions
How to put a permanent notification on phone? 0 Answers
Extending the UnityPlayerActivity Java Code fail to build 1 Answer
Having issue with "unable to convert class to dex format" extremely simple JAR in empty project. 0 Answers
Call android code which then calls a method in jar file 1 Answer
unity android crash report problem 0 Answers