コード例 #1
0
        public string HelloWorld(String msg)
        {
            var Msg1 = string.Empty;

            //  Msg = MyJGPush.MyPush.SendPush("新年快乐", "新年快乐!", 1, "s_registrationId:你的设备ID");//IOS设备推送
            //  Msg = MyJGPush.MyPush.SendPush("新年快乐", "新年快乐!", 0, "aaa");//安卓设备推送
            Msg1 = MyPush.SendPush("新年快乐", msg, 3, "");//群发

            return(Msg1);
        }
コード例 #2
0
    public void SendPushMessage(string user_id, string msg, string head)
    {
        //Create our push services broker
        var push = new PushBroker();

        MyPush p = MyPush.GetPushInfo(user_id);

        push.RegisterGcmService(new GcmPushChannelSettings(WebConfigurationManager.AppSettings["apiKey"]));

        push.QueueNotification(new GcmNotification().ForDeviceRegistrationId(p.Push_str)
                               .WithJson("{\"message\": \" " + msg + " \", \"title\": \" " + head + " \"}"));

        //Stop and wait for the queues to drains
        push.StopAllServices();
    }
コード例 #3
0
ファイル: MyPush.cs プロジェクト: Raz1990/EZDrive
    public static MyPush GetPushInfo(string id)
    {
        SqlParameter parameter = new SqlParameter("@id", id);

        MyPush push = new MyPush();

        DataTable dt = db.GetDataSetByQuery("GetPushInfo", System.Data.CommandType.StoredProcedure, parameter).Tables[0];
        DataRow   dr;

        try
        {
            dr = dt.Rows[0];
        }
        catch (Exception)
        {
            return(null);
        }

        push.Id       = (string)dr[0];
        push.Platform = (string)dr[1];
        push.Push_str = (string)dr[2];

        return(push);
    }
コード例 #4
0
 public void RegisterPushNumber(string user_id, string platform, string pushID)
 {
     MyPush.InsertPushID(user_id, platform, pushID);
 }