Eduardoavargas / gcm

Automatically exported from code.google.com/p/gcm
Apache License 2.0
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
Inside here obviously:
public class Sender {
...
public Result sendNoRetry(...)
...
}

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

GoogleCodeExporter commented 9 years ago
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 commented 9 years ago
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 commented 9 years ago
+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