EDIT 3
I use RhoMobile to get device_token, which I am getting to server
def register_device
@person = Person.find(:first)
unless System.get_property('is_emulator')
url = "#{@base}/users/#{@person.remote_id}/register_device?os=#{System.get_property('platform')}&device_token=#{System.get_property('device_id')}"
Rho::AsyncHttp.get(
:url => url,
:headers => {'User-Agent' => Rho::RhoConfig.user_agent}
)
end
finish_and_go_to_venue
end
EDIT 2
Have device_token but keep getting Error=NotRegistered
EDIT
OK, so first mistake was using the wrong device ID. Now working, but phone not alerting with message.
ORIGINAL
First time user of sending android Push messages from rails server.
Using https://github.com/sghael/speedy_c2dm
I registered with google and received white list email.
trying test.rb below, but nothing gets sent to phone.
require 'rubygems'
require 'bundler'
Bundler.setup(:default, :development)
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'speedy_c2dm'
TEST_EMAIL = "my_push_email@gmail.com"
TEST_PASSWORD = "MY_PASSWORD"
TEST_REGISTRATION_ID = "DEVICE_TOKEN_RECEIVED_FROM_PHONE"
speedyC2DM = SpeedyC2DM::API.new(TEST_EMAIL, TEST_PASSWORD)
options = {
:registration_id => TEST_REGISTRATION_ID,
:message => "Hi!",
:extra_data => 42,
:collapse_key => "some-collapse-key"
}
response = speedyC2DM.send_notification(options)
Try adding a Controller named Push and inside the controller you need to have the following:
you need to set your application to call this by adding the following line to your application.rb
Also, did you configure your build.yml correctly?
At least with my app, I need to have the application running in order to get the message.