Parse.com用于从.NET框架发送推送通知并在iOS,Android和网页上接收

时间:2021-03-27 16:27:26

I am completely new to parse and looking at the documentations I am actually lost.

我是一个全新的解析和查看我实际上丢失的文档。

Here, is what i need and know

在这里,是我需要和知道的

  1. I have my own backend, so I just need parse to send notifications from server to iOS, Android and webpage(optional).
  2. 我有自己的后端,所以我只需要解析就可以从服务器向iOS,Android和网页发送通知(可选)。

  3. Users Login on their devices through WCF service.
  4. 用户通过WCF服务在其设备上登录。

  5. How do i send push message to specific user or multiple users. There are options to send message to channels, everyone; but how do I construct this group of peoples i want to send it to from my .NET application?
  6. 如何向特定用户或多个用户发送推送消息。每个人都可以选择向频道发送消息;但是我如何构建这组人,我想从.NET应用程序发送它?

  7. I found this How do I send API push message with .Net / Parse.com? (C#) and i also downloaded parse.com nuget package which made me confused on what the parse.dll is for. The method in the link use REST method to send push notification.
  8. 我发现这个如何使用.Net / Parse.com发送API推送消息? (C#)我也下载了parse.com nuget包,让我对parse.dll的用途感到困惑。链接中的方法使用REST方法发送推送通知。

  9. Push test from the web interface of parse.com and REST method is working and being received on iOS and Android. Have not tested on website.
  10. 从parse.com的web界面推送测试,REST方法正在工作,并在iOS和Android上接收。没有在网站上测试过。

1 个解决方案

#1


0  

NOTE: I use parse to send Push notification only, not as a data storage, that it also provides.

注意:我使用parse仅发送Push通知,而不是它也提供的数据存储。

So after some time using it I found things as follows

所以经过一段时间的使用后,我发现了以下内容

  1. Requires this first of all. ParseClient.Initialize('ParseApplicationKey', 'ParseDotNetKey');. You should put it code first hits, when you first load the applicaiton. ie. startup.cs or global.asax.cs This is a one hit thing.
  2. 首先需要这个。 ParseClient.Initialize('ParseApplicationKey','ParseDotNetKey');.首次加载应用程序时,应该首先将代码置于代码中。即。 startup.cs或global.asax.cs这是一个很受欢迎的事情。

  3. Sending pushes uses Installation class/table in parse.com. You can add your own columns to the class. I added ContactId so that i could query against the id to send push.
  4. 发送推送使用parse.com中的安装类/表。您可以将自己的列添加到类中。我添加了ContactId,以便我可以查询id来发送推送。

  5. You need to enable Client Push Enabled? before you can send pushes. Otherwise you will get error like Client-initiated push isn't enabled
  6. 您需要启用Client Push Enabled吗?在你发送推送之前。否则,您将收到错误,例如未启用客户端启动的推送

  7. Now Sending push notification
  8. 现在发送推送通知


// sending to all with only alert message
var parsePush = new ParsePush();
parsePush.Alert="hi";
await parsePush.SendAsync();

// sending to all with your own data
parsePush.Data= new Dictionary<string, object>
            {
                {"alert", message},// this is replacement for parsePush.Alert
                {"sound", "notify.caf"},// for ios
                {"badge", "Increment"}// for ios notification count increment on icon
            };
await parsePush.SendAsync();
// Sending with custom data, you can add your own properties in the 
// dictionary and send, which will be received by the mobile devices
{"reference_type", referenceType}// add to dictionary
{"reference_id", referenceType}

// adding query/conditions 
int[] smartusers={1,2,3,4,5};
parsePush.Query = new ParseQuery<ParseInstallation>()
          .Where(i => smartusers.Contains(i.Get<int>("ContactID")));
// ContactID is a propery in ParseInstallation, that i added

There are other methods for targeting notifications https://parse.com/docs/dotnet/guide#push-notifications-sending-pushes

还有其他定位通知的方法https://parse.com/docs/dotnet/guide#push-notifications-sending-pushes

For more info https://parse.com/docs/dotnet/guide#push-notifications

有关详细信息,请访问https://parse.com/docs/dotnet/guide#push-notifications

#1


0  

NOTE: I use parse to send Push notification only, not as a data storage, that it also provides.

注意:我使用parse仅发送Push通知,而不是它也提供的数据存储。

So after some time using it I found things as follows

所以经过一段时间的使用后,我发现了以下内容

  1. Requires this first of all. ParseClient.Initialize('ParseApplicationKey', 'ParseDotNetKey');. You should put it code first hits, when you first load the applicaiton. ie. startup.cs or global.asax.cs This is a one hit thing.
  2. 首先需要这个。 ParseClient.Initialize('ParseApplicationKey','ParseDotNetKey');.首次加载应用程序时,应该首先将代码置于代码中。即。 startup.cs或global.asax.cs这是一个很受欢迎的事情。

  3. Sending pushes uses Installation class/table in parse.com. You can add your own columns to the class. I added ContactId so that i could query against the id to send push.
  4. 发送推送使用parse.com中的安装类/表。您可以将自己的列添加到类中。我添加了ContactId,以便我可以查询id来发送推送。

  5. You need to enable Client Push Enabled? before you can send pushes. Otherwise you will get error like Client-initiated push isn't enabled
  6. 您需要启用Client Push Enabled吗?在你发送推送之前。否则,您将收到错误,例如未启用客户端启动的推送

  7. Now Sending push notification
  8. 现在发送推送通知


// sending to all with only alert message
var parsePush = new ParsePush();
parsePush.Alert="hi";
await parsePush.SendAsync();

// sending to all with your own data
parsePush.Data= new Dictionary<string, object>
            {
                {"alert", message},// this is replacement for parsePush.Alert
                {"sound", "notify.caf"},// for ios
                {"badge", "Increment"}// for ios notification count increment on icon
            };
await parsePush.SendAsync();
// Sending with custom data, you can add your own properties in the 
// dictionary and send, which will be received by the mobile devices
{"reference_type", referenceType}// add to dictionary
{"reference_id", referenceType}

// adding query/conditions 
int[] smartusers={1,2,3,4,5};
parsePush.Query = new ParseQuery<ParseInstallation>()
          .Where(i => smartusers.Contains(i.Get<int>("ContactID")));
// ContactID is a propery in ParseInstallation, that i added

There are other methods for targeting notifications https://parse.com/docs/dotnet/guide#push-notifications-sending-pushes

还有其他定位通知的方法https://parse.com/docs/dotnet/guide#push-notifications-sending-pushes

For more info https://parse.com/docs/dotnet/guide#push-notifications

有关详细信息,请访问https://parse.com/docs/dotnet/guide#push-notifications