Beispiel #1
0
    private void PushPointinformation()
    {
        if (nearIndexList.Count != 0)
        {
            PushItem newPushMsg = pushPointIndexV2Dic[int.Parse(nearIndexList[0].id)];
            if (GlobalParameter.lastPushId != int.Parse(newPushMsg.id))
            {
                NotifyCallBack notifyCallBack = new NotifyCallBack()
                {
                    dbid = newPushMsg.dbid,
                    type = newPushMsg.type
                };

#if UNITY_ANDROID
                AndroidJavaClass  jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
                AndroidJavaObject jo = jc.GetStatic <AndroidJavaObject>("currentActivity");
                jo.Call("notifySimpleMessage", newPushMsg.title, newPushMsg.msg, JsonMapper.ToJson(notifyCallBack));
                GlobalParameter.lastPushId = int.Parse(newPushMsg.id);
#elif UNITY_IOS || UNITY_IPHONE
                pushState = 0;
                LocalNotifyStyle style = new LocalNotifyStyle();
                Hashtable        args  = new Hashtable();
                args["dbid"] = newPushMsg.dbid;
                args["type"] = newPushMsg.type;
                style.setContent(newPushMsg.msg);
                style.setTitle(newPushMsg.title);
                style.addHashParams(args);
                mobPush.setMobPushLocalNotification(style);
                GlobalParameter.lastPushId = int.Parse(newPushMsg.id);
#endif
            }
        }
    }
Beispiel #2
0
    private static void SetMobPushFatigue(uint index, long time)
    {
        var value = (int)index + 1;

        PlayerPrefs.SetInt(index + SwitchType.Fatigue.ToString(), value);

        var style = new LocalNotifyStyle();

        style.setNotifyId(value.ToString());
        style.setTitle(Util.GetString(278, 0));
        style.setContent(Util.GetString(278, 1));
        style.setTimestamp(time * 1000);

        m_mobPush.setMobPushLocalNotification(style);

        Logger.LogDetail("SDKManager:: Set <b><color=#00FF00>[{0}]</color></b> notification delay time to <b><color=#FFFFFF>{1}</color></b>", SwitchType.Fatigue, time * 1000);
    }
Beispiel #3
0
    void OnGUI()
    {
        GUI.skin = demoSkin;

        float scale = 1.0f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            scale = Screen.width / 320;
        }

        //float btnWidth = 165 * scale;
        float btnWidth  = Screen.width / 5 * 2;
        float btnHeight = Screen.height / 25;
        float btnTop    = 30 * scale;
        float btnGap    = 20 * scale;

        GUI.skin.button.fontSize = Convert.ToInt32(13 * scale);

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Send Notify"))
        {
            Hashtable extras = new Hashtable();
            extras.Add("key1", "value1");
            extras.Add("key2", "value2");
            extras.Add("key3", "value3");
            mobPush.req(1, "content-Send Notify", 0, extras);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Send App Notify"))
        {
            mobPush.req(2, "App Notify", 0, null);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "Send Delayed Notify"))
        {
            mobPush.req(3, "Delayed Notify", 1, null);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "Send Locat Notify"))
        {
            LocalNotifyStyle style = new LocalNotifyStyle();
            style.setContent("Text");
            style.setTitle("title");

                #if UNITY_ANDROID
            Hashtable extras = new Hashtable();
            extras["key1"] = "value1";
            extras["key2"] = "value1";
            style.setExtras(extras);
                #endif

            mobPush.setMobPushLocalNotification(style);
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "CustomNotify"))
        {
            CustomNotifyStyle style = new CustomNotifyStyle();

                #if UNITY_IPHONE
            style.setType(CustomNotifyStyle.AuthorizationType.Badge | CustomNotifyStyle.AuthorizationType.Sound | CustomNotifyStyle.AuthorizationType.Alert);
                #elif UNITY_ANDROID
            style.setContent("Content");
            style.setTitle("Title");
            style.setTickerText("TickerText");
                #endif

            mobPush.setCustomNotification(style);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "getRegistrationId"))
        {
            mobPush.getRegistrationId();
        }

        //Test Code
        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "addTags"))
        {
            String[] tags = { "tags1", "tags2", "tags3" };
            mobPush.addTags(tags);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "getTags"))
        {
            mobPush.getTags();
        }


        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "deleteTags"))
        {
            String[] tags = { "tags1", "tags2", "tags3" };
            mobPush.deleteTags(tags);
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "cleanAllTags"))
        {
            mobPush.cleanAllTags();
        }


        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "addAlias"))
        {
            mobPush.addAlias("alias");
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "getAlias"))
        {
            mobPush.getAlias();
        }


        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "cleanAllAlias"))
        {
            mobPush.cleanAllAlias();
        }

                #if UNITY_ANDROID
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "stopPush"))
        {
            mobPush.stopPush();
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "restartPush"))
        {
            mobPush.restartPush();
        }

        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 + btnGap, btnTop, btnWidth, btnHeight), "isPushStop"))
        {
            mobPush.isPushStopped();
        }

        btnTop += btnHeight + 20 * scale;
        if (GUI.Button(new Rect((Screen.width - btnGap) / 2 - btnWidth, btnTop, btnWidth, btnHeight), "setClickNotificationToLaunchPage"))
        {
            mobPush.setClickNotificationToLaunchPage(false);
        }
                #endif
    }