Android Tutorial Android push notification (GCM) framework and tutorial

Discussion in 'Tutorials & Examples' started by Erel, Jul 3, 2012.

  1. gordon

    gordon Member Licensed User

    Yup :sign0161:
    But all is well now.

    Thanks to all those who responded.
     
  2. Teknomatica

    Teknomatica Member Licensed User

    Hi EREL
    our config.txt file is configured correctly. Our server don't have a static IP address, so if we use current IP or anonimous Key all works fine but, if we use the API server key generated with URL (we are under DynDNS service) don't works.
    Any suggest?
    Thanks in advance


    Fabio (Teknomatica)
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the link that works and the link that doesn't work?
     
  4. Teknomatica

    Teknomatica Member Licensed User

    [​IMG]

    Thanks in advance
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Which error do you get when you run the desktop tool?
     
  6. Teknomatica

    Teknomatica Member Licensed User

    Error HTTP 401.
     
  7. Teknomatica

    Teknomatica Member Licensed User


    Detailed:
    C:\GCM>b4a_gcm send USER TEXT

    C:\GCM>java -cp b4a_gcm.jar anywheresoftware.b4a.c2dm.C2DM send USER TEXT
    java.lang.RuntimeException: java.io.IOException: Server returned HTTP response c
    ode: 401 for URL: https://android.googleapis.com/gcm/send
    at anywheresoftware.b4a.c2dm.C2DM.sendMessageTo(C2DM.java:57)
    at anywheresoftware.b4a.c2dm.C2DM.main(C2DM.java:218)

    Thanks
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    This error is not related to your server. It isn't able to access Google GCM server.
    Try to run 'getall' instead of send and see whether it works.
     
  9. Teknomatica

    Teknomatica Member Licensed User

    getall -> "not supported"

    Pls, I don't think that the error is referred to Google GCM server; if I change URL with the IP (and related api key): works!!! I hope my english is clear...

    Thanks
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    This is strange. Are you sure that you are not using the web server hosted on this server?

    You can see from the error message that it fails to connect to Google server.
     
  11. Teknomatica

    Teknomatica Member Licensed User

    I don't understand. How may I sure of this usage ?
     
  12. Erel

    Erel Administrator Staff Member Licensed User

    Can you post the contents of config.txt?
     
  13. Teknomatica

    Teknomatica Member Licensed User


    board_url=http://b4aserver.basic4ppc.com/c2dm_board.php
    server_password=9034f3po4gj34
    api_key=AIzaSyAMxL33hrg8qjAavDYaNU5BZxL0cGjwXkI

    this is the config file with ApiKey that don't workm (referred to teknomatica.ath.cx)

    thanks
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    I may be missing something, but you do not need to provide any IP address or domain name when you register with Google. You should follow the steps in the tutorial.
     
  15. Teknomatica

    Teknomatica Member Licensed User

    Pls, excuse me Erel, but in your tutorial is written:
    "2. Click Create new Server key. Either a server key or a browser key should work. The advantage to using a server key is that it allows you to whitelist IP addresses. The following screen appears:"

    Google shows a form with these captions:
    "Configure Server Key for API Project


    This key should be kept secret on your server.
    Every API request is generated by software running on a machine that you control. Per-user limits will be enforced using the address found in each request's userIp parameter, (if specified). If the userIp parameter is missing, your machine's IP address will be used instead. Learn more
    Accept requests from these server IP addresses:
    ....
    Example: 192.168.12.0/23. One IP address or subnet per line."

    What's wrong?
    Thanks

    Thanks
     
  16. QLogic

    QLogic Member Licensed User

    Quick Question....

    Is it possible to run on a web server that doesn't support php?

    Thanks.
     
  17. Erel

    Erel Administrator Staff Member Licensed User

    Teknomatica, note that this is Google tutorial you are referring to, not my tutorial.
    You can use the browser option instead.

    QLogic, you can use any other web server. In this example it is implemented as a PHP script. You will however need to implement a similar solution.
     
  18. QLogic

    QLogic Member Licensed User

    Let's say I'd want to implement it on a .NET server with SQL Server 2008. Is it possible that way?
     
  19. Erel

    Erel Administrator Staff Member Licensed User

    The web service is responsible for handling the device registrations. It can be implemented with any technology you like. In fact you can even do it manually by saving the device registration ID on a paper.
     
  20. HarryH

    HarryH New Member

    Hmmm, I like to examen the 3 attached files to learn from it, so I registered but no way to get those files... I dont have permissions?
    Anyone?
     
Loading...