3

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. Users Login on their devices through WCF service.
  3. 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?
  4. 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.
  5. 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.
Community
  • 1
  • 1
Ruchan
  • 3,124
  • 7
  • 36
  • 72
  • Did you ever get this working? I'm also trying to use the Parse SDK for backend only, but all of the documentation is for Windows Phone and Windows RT. Any information would help all of us I'm sure. – Tim Jun 30 '15 at 23:05
  • I did get it working quite well, i must say. I will be posting my findings later today. Tip: You have to dig for long time in the documentations. – Ruchan Jul 01 '15 at 06:39

1 Answers1

0

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

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. 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.
  3. You need to enable Client Push Enabled? before you can send pushes. Otherwise you will get error like Client-initiated push isn't enabled
  4. Now Sending push notification

// 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

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

Ruchan
  • 3,124
  • 7
  • 36
  • 72