• Resolved Salvatore

    (@mistyanet)


    hi there! I’ve an iOS app with push notification.

    If i send a push notification by parse everything is ok, if I send by wordpress “Simple Parse Push Service” plugin they are not delivered. WHY?

    here a log of push notification by wordpress plugin

    Targeting : channels includes “” deviceType is any of “ios”, “android”, “winphone”, or “js” Sending date : November 11th, 2013 at 1:59 PM Expiration : January 1st, 2016 at 1:00 AM Full target : { “channels”: { “$in”: [ “” ] }, “deviceType”: { “$in”: [ “ios”, “android”, “winphone”, “js” ] } } Full data : { “alert”: “prova secondo push”, “badge”: “test3”, “sound”: “” }

    here a log of push notification by parse (this one work very well)

    Targeting : deviceType is “ios” Sending date : November 11th, 2013 at 12:58 PM Expiration : None Full target : { “deviceType”: “ios” } Full data : { “alert”: “prova marco”, “sound”: “” }

    sorry for my bad english

    http://wordpress.org/plugins/simple-parse-push-service/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author dtsolis

    (@dtsolis)

    Hello and thank you for downloading the plugin,
    This output doesn’t seem to be wrong…
    The plugin assumes that the user has been subscribed to the broadcast channel.

    Is there any chance that in your iOS app, the users are subscribed in a channel named something different than “” ?

    Thread Starter Salvatore

    (@mistyanet)

    Hi,
    thank’s a lot for your work!

    My users aren’t subscribed to a channel

    http://screencloud.net/v/cXnQ

    i’ve solved by changing the array on $data

    $data = array(
    	    'where' => '{}',
    	    'expiry' => 1451606400,
    	    'data' => array(
    	        'alert' => $AlertMessage,
    	        'badge' => $Badge,
    	    ),
    	);
    Plugin Author dtsolis

    (@dtsolis)

    Nice! I’ll work on an update with the ability to set custom channel or no channel.

    Thanks for your feedback!

    Plugin Hello, and installed. I could not send push notifications, but thanks to Salvatore can already do.

    My question is: When I post an entry, send push notifications to mobile.
    But I can do so that when users click, fence to the website where this article?

    My code is as follows:

    @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            Parse.initialize(this, "xxxxxxxxxxxxxxxxxxxxxxx",
                    "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy");
            PushService.setDefaultPushCallback(this, MainActivity.class);
            ParseInstallation.getCurrentInstallation().saveInBackground();
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            init();
    
        }

    Thanks, and sorry for the English.

    @f3ernan: If you require assistance then, as per the Forum Welcome, please post your own topic.

    Plugin Author dtsolis

    (@dtsolis)

    Hi and thanks for your support!
    As i can see you’re on Android so i cannot help you much because it’s more about Android development and i didn’t have the chance to do much on this area.

    But, as i think parse’s documentation is pretty good. Take a look here https://parse.com/docs/push_guide#receiving-responding/Android.
    As you can see, application receives a JSONObject which you have to parse and get all the info.

    This plugin adds to the payload an extra key-value pair with the key name “post_id”.
    So, in order to get the post_id you’re using the same way you use to get the title from the JSON payload.
    After that and assuming your post_id is equal to 15, using the url ....your-wordpress-website.com/?p=15&feed=rss&withoutcomments=1 you get your article’s feed and do whatever you want.
    If you don’t want the feed, the url then is ....your-wordpress-website.com/?p=15

    Hope that helps.

    Hello again. sorry for being heavy. But not much programming. I’m just an amateur.

    Regarding what dtsolis commented, this code is the example of Parse.com
    That would have to change parameters here to receive the URL of the post and open the browser?

    The plugin works great.

    Thank you again.

    @Override
      public void onReceive(Context context, Intent intent) {
        try {
          String action = intent.getAction();
          String channel = intent.getExtras().getString("com.parse.Channel");
          JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));
    
          Log.d(TAG, "got action " + action + " on channel " + channel + " with:");
          Iterator itr = json.keys();
          while (itr.hasNext()) {
            String key = (String) itr.next();
            Log.d(TAG, "..." + key + " => " + json.getString(key));
          }
        } catch (JSONException e) {
          Log.d(TAG, "JSONException: " + e.getMessage());
        }
      }
    }
    Plugin Author dtsolis

    (@dtsolis)

    In this while function

    while (itr.hasNext()) {
            String key = (String) itr.next();
            Log.d(TAG, "..." + key + " => " + json.getString(key));
          }

    You could do something like this

    while (itr.hasNext()) {
            String key = (String) itr.next();
            if ( key.equals("post_id") ) {
                   int post_id = json.getInt(key);
                   // ...do whatever you want with the post_id
            }
            Log.d(TAG, "..." + key + " => " + json.getString(key));
          }
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Notification are not delivered :(’ is closed to new replies.