Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

dryRun not honored when using values of 1 and 0 #21

Closed
GoogleCodeExporter opened this issue Mar 17, 2015 · 5 comments
Closed

dryRun not honored when using values of 1 and 0 #21

GoogleCodeExporter opened this issue Mar 17, 2015 · 5 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Prepare a valid GCM message.
2. Build the message and set dryRun to true (Builder()....dryRun(true))
3. Send it and watch it appear on your phone (sender.send(...))

What is the expected output? What do you see instead?

The expected output is NOT seeing an alert on my phone when dryRun is set to 
true. Instead, I see the alert on the phone.

What version of the product are you using? On what operating system?
Fresh pull of the source as of 4/17/13

Please provide any additional information below.

Changing the dryRun values to "true" or "false" instead of "1" or "0" seems to 
work. 

if (dryRun != null) {
      addParameter(body, PARAM_DRY_RUN, dryRun ? "true" : "false");
    }



Original issue reported on code.google.com by lro...@gmail.com on 17 Apr 2013 at 9:18

@GoogleCodeExporter
Copy link
Author

Inside here obviously:
public class Sender {
...
public Result sendNoRetry(...)
...
}

Original comment by lro...@gmail.com on 17 Apr 2013 at 9:28

@GoogleCodeExporter
Copy link
Author

Per the docs:

dry_run -  If included, allows developers to test their request without 
actually sending a message. Optional. The default value is false, and must be a 
JSON boolean.
http://developer.android.com/google/gcm/gcm.html

Original comment by lro...@gmail.com on 17 Apr 2013 at 9:42

@GoogleCodeExporter
Copy link
Author

Have you tried using 

if (dryRun != null) {
      addParameter(body, PARAM_DRY_RUN, dryRun ? "1" : "0");
    }

Original comment by raj...@gmail.com on 29 Oct 2013 at 6:01

@GoogleCodeExporter
Copy link
Author

+1 This is happening to me as well, and per the Android Developer docs 
PARAM_DRY_RUN (aka "dry_run") needs to be a JSON boolean. Thus will only 
support values of "true" or "false" and not the "1" or "0" that is in the code.

Original comment by Drummer8...@gmail.com on 4 Dec 2013 at 1:43

@vvondra
Copy link

vvondra commented Jan 20, 2016

fixed in 399e88c

@silvolu silvolu closed this as completed Jan 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants