Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I am using Google Cloud Messaging for one of my projects. I think I have configured everything correctly. I am getting the following error when I tried to send some message.

Notice: Undefined offset: 1 in gcm_action_send_message()

I cant find any information in the module documentation.

share|improve this question
    
May you show the code you are using? –  kiamlaluno Jan 17 '13 at 9:33
    
@kiamlaluno, its all set up with configuration forms i am doing nothing via code. –  Nikhil M Jan 17 '13 at 9:42
1  
this looks like something that would live better as a bug report in the issue queue than an open question here. –  David Meister Jan 17 '13 at 12:31
    
@DavidMeister, This is not a bug. Lack of documentation only. See my answer. –  Nikhil M Jan 17 '13 at 13:48
    
Not providing inline documentation for an API function is a bug in the documentation. According to drupal.org/node/1354#functions. File an issue please. –  David Meister Jan 17 '13 at 14:32

1 Answer 1

up vote 4 down vote accepted

I found the answer by looking the code used from the module.

function gcm_action_send_message($tokens, $keyValues, $delay_while_idle, $time_to_live, $collapse_key) {

    $gcm_message = array();
    foreach (explode(",", $keyValues) as $keyValue) {
      $temp = explode("=", $keyValue);
      $key = $temp[0];
      $value = $temp[1];
      if (isset($key) && isset($value)) {
        $gcm_message[$key] = $value;
      }
    }
    gcm_send_message(array_unique(explode(',', $tokens)), $gcm_message, $delay_while_idle, $time_to_live, $collapse_key);
}

So we need to use for key-values a value like 0=[site:name], 1=[site:mail].

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.