Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter nazarmak

    (@nazarmak)

    when i check my wp_push_logs table or debug section then some record founds like this

    /pnfw/register/?token=APA91bH5iXncA9w0L-Co5WxaxALkbibEnti-E5m4CQt6HtWfTtNQpH5evHFpl4JAN9puA-TxuukVpa2NJ131Rz4hBuNfBdNfeczx0esuBqt3rQEs_wEPxjvdvx3yrALj22HW5sNYZF0SDuudQJR2LWvTr961p6x1cg&os=Android API Error (401) from IP address 103.21.186.154: Unauthorized, Parameter oauth_consumer_key is missing.

    Plugin Author Delite Studio

    (@delitestudio)

    Hello, first of all try to disabile OAuth under Push Notifications > OAuth to ease the configuration of Push Notifications for WordPress (Lite).

    If it works and you want to use OAuth you must follow the official documentation guide to OAuth & API Keys.

    Thread Starter nazarmak

    (@nazarmak)

    when i try to disable the OAuth under Push Notifications then it display the this type of error

    /pnfw/register/?token=APA91bH6V6uvRpZcD4f1QKb4TIWwZTC8lZFezZWtq6DrBERsssl8GjX2_qnsHKGYnh4NOVC6YqrKzEDU-CtN2KETpFlmCWYjmy3TSKf3FvYxGkJP6-AHflBCfQLhOvc0YRLpXN5s-dzc_d7NaiNjSZH72ElYgfeoWw&os=Android API Error (500) from IP address xx.xx.xx.xx: Internal Server Error, Mandatory parameter os missing.

    whenever i include the os in the given url like this https://yoursite.com/pnfw/register/?token=new_device_id&os=Android

    Plugin Author Delite Studio

    (@delitestudio)

    The Register API requires the HTTP POST method, so you can’t pass the os parameter in the query string. You should follow the official documentation.

    Hope it helps!

    Thread Starter nazarmak

    (@nazarmak)

    Hi,

    thanks for your quick response..

    yes, I used the HTTP POST method in my code.and used query string as pass the parameter, which is wrong.
    first time i used the wordpress with android app so i am little bit confused.so provide me the solution of these issue.

    1). can you provide me the full life cycle working of this plugin.
    2). can you provide the example or working demo to integrate the android app using this plugin.
    3). I checked your documentation of register api section. but not getting your point that how to used the token_id and os paramater. can you provide a example to do it.
    Thanks in advance..

    Plugin Author Delite Studio

    (@delitestudio)

    We suggest you to purchase our libraries for Android and iOS to ease the integration.

    You can even purchase our pre-packaged application or try to use the free WordPress Hybrid Client (as WPHC is a third party software we cannot give you support on using it).

    Plugin Author Delite Studio

    (@delitestudio)

    Hello! Not having received any response we’ll assume that the problem is resolved and close this thread. Kind regards!

    i got the same 401 issue. when I post to register api. I have disabled the OAuth. In log, it complains invalid http method. Can you give an example on the method?

    Plugin Author Delite Studio

    (@delitestudio)

    Hello, we suggest you to purchase our libraries for Android and iOS to ease the integration but you can follow the documentation that is full of examples.

    When you receive a 401 invalid HTTP method you are calling the register endpoint with an HTTP method that is not POST. Please follow the documentation.

    Sure I can consider using your IOS library. But without a trial, I wonder if it will works on my App. I am using the following code. Can you let me know what’s wrong

    NSString *token = [[[[deviceToken description]
    stringByReplacingOccurrencesOfString: @”<” withString: @””]
    stringByReplacingOccurrencesOfString: @”>” withString: @””]
    stringByReplacingOccurrencesOfString: @” ” withString: @””];
    NSString *postString = @”[email protected]&os=iOS&token=”;
    postString = [postString stringByAppendingString:token];
    NSData *postData = [postString dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:true];
    NSString *postLength = [NSString stringWithFormat:@”%d”, [postData length]];

    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
    [request setURL:[NSURL URLWithString:@”https://myweb.com/pnfw/register/”%5D%5D;
    [request setHTTPMethod:@”POST”];
    //[request setValue:postLength forHTTPHeaderField:@”Content-Length”];
    [request setValue:@”application/x-www-form-urlencoded” forHTTPHeaderField:@”Content-Type”];
    [request setHTTPBody:postData];

    NSURLSession *session = [NSURLSession sharedSession];

    NSURLSessionDataTask *postDataTask= [session dataTaskWithRequest: request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
    NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*) response;
    int statusCode = (int)[httpResponse statusCode];
    statusCode = statusCode;
    }];
    [postDataTask resume];

    Plugin Author Delite Studio

    (@delitestudio)

    If you try this curl command:

    curl https://myweb.com/pnfw/register/ --data "os=iOS&token=mytoken"

    do you have any success?

    If yes your Push Notifications for WordPress (Lite) installation is working and your code has something wrong.

    $ curl https://massoc.club/pnfw/regiter/ –data “os=iOS&token=cb04b09d067462d79d16380d20d8403d1b6a9bd690f454bb446346ff0759bc88″0x000000012cdd49a0”
    >

    I got this. Is it ok?

    Plugin Author Delite Studio

    (@delitestudio)

    You have not closed the data string after the token code and you have written “regiter” instead of “register”! Please be more accurate in doing tests!

    After that if everything is ok you’ll find a new token in the Tokens section of the plugin.

    This assures that the plugin is working correctly and something is wrong with the code you have implemented in iOS (as curl is just doing a simple POST request as described in our documentation).

    As we cannot provide code level support for the free version of the plugin we suggest you to buy the iOS library or upgrade to Push Notifications for WordPress.

    Great. It works using curl. So I am sure I will buy the IOS lib from you. Your work worth the money!

    But seriously, please talk me into your premium ver.

    I wonder if the following can be done.
    1. I would like to let users to subscribes to different categories of notification. i.e. users only got notified when a new post is posted on the categories he subscribed to.
    2. Do you have a page in setting so that admin can send notifications to users.
    3. can users divided into groups?
    4. do you have sample PHP codes, so that I can incorporate into my pages to send notifications?

    Plugin Author Delite Studio

    (@delitestudio)

    Good! First of all: in the premium version you’ll have the rights to download the iOS and Android libraries for free.

    1. I would like to let users to subscribes to different categories of notification. i.e. users only got notified when a new post is posted on the categories he subscribed to.

    Yes, it’s possibile (search for Categories API).

    2. Do you have a page in setting so that admin can send notifications to users.

    Yes, a box will appear in the post editing page, near the Publish button.

    3. can users divided into groups?

    Yes, here it’s explained.

    4. do you have sample PHP codes, so that I can incorporate into my pages to send notifications?

    The pro version is full of Hooks and functions you can use to extend and customise the behaviour of the plugin.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘not connect the android app to wordpress site using register api.’ is closed to new replies.