Android Tutorial Simple Push Framework

schimanski

Well-Known Member
Licensed User
Longtime User
Hello!

I'm trying the simple push framework, but it is not possible to send a message to my devices.The devices are registert very well, but I always get the message: Error sending message: Unauthorized....

B4X:
Program started.
Checking mails
No messages.
Feb 25, 2014 6:57:04 PM org.apache.http.impl.client.DefaultRequestDirector handleResponse
Warnung: Authentication error: Unable to respond to any of these challenges: {}
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
Error sending message: Unauthorized
 

schimanski

Well-Known Member
Licensed User
Longtime User
Thanks for your replay, Erel..

But I have tried the server-api-key and a browser api-Key, but both the same Problem....

I'm not able to see, where the Problem is...
 

schimanski

Well-Known Member
Licensed User
Longtime User
For my server-api key, I have used the IP 0.0.0.0/0.

Could that be the Problem?
 

schimanski

Well-Known Member
Licensed User
Longtime User
Yes, I have activated the following features:

BigQuery API ON
Google Cloud Messaging for Android ON
Google Cloud SQL ON
Google Cloud Storage ON
Google Cloud Storage JSON API ON
 

schimanski

Well-Known Member
Licensed User
Longtime User
I have now make a complete new google-account with a brand new api-key...but it is always the same problem...


B4X:
Program started.
Checking mails
Found messages: 1
1
Message from:  xxxxxx@gmail.com, subject:  add
Testname: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Feb 28, 2014 9:49:50 AM org.apache.http.impl.client.DefaultRequestDirector handleResponse
Warnung: Authentication error: Unable to respond to any of these challenges: {}
<HTML>
<HEAD>
<TITLE>Unauthorized</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Unauthorized</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
Error sending message: Unauthorized

I'm not sure, if there is something to do for me in

 

schimanski

Well-Known Member
Licensed User
Longtime User
Jo, now I have tried the browser-key with the new account...and it runs perfect...
 

schimanski

Well-Known Member
Licensed User
Longtime User
I have one question about the gcm: Which data is stored by google, when I register my device? I thought, that it is my device-name and the id, which I get from google. When receiving a message, I get the sender in 'from' and the message in 'data'. But the sender in from is not my regitered name. It is only a number.???
 

schimanski

Well-Known Member
Licensed User
Longtime User
When I copy the files on my usb-stick an starts the POP3.jar on another windows-computer, I get the following error, after clicking 'Check Now'.

03/26/2014 19:04:49: Error: (SunCertPathBuilderException) sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

what is the problem?
 

schimanski

Well-Known Member
Licensed User
Longtime User
Now I have installed b4j on my second windows 7-notebook and compiled the pop3.jar directly on the notebook, but I always get the same error....

???
 

JOANORSKY

Member
Licensed User
Longtime User
Is there a way to get the currently subscribed devices on the GCM? This would be great in order to implement a real-time subscription UI button (like.. GREEN if already subscribed or RED if not yet subscribed).. well.. i guess you get the idea..
 

Harris

Expert
Licensed User
Longtime User
Is there a way to get the currently subscribed devices on the GCM?

All registered devices should update your table. This is how I know how many "paid" subscribers can access a users (owner) account.

In order for a device to register, they must be provided - by the owner of the account - with a reg ID. Some one has to communicate to them this key (GCM id). Now, all messages produced from the client (device) or the server are passed thru this account.

I have even configured this: messages sent from a device can be forwarded to another device - once it has reached the server.
This is handy when someone cannot monitor the web app, but can receive all messages from the "fleet" on their device when away from their desktop.

Now, to implement: respond directly to these messages from the sender. Not so difficult as I see.

Summary: GCM is a powerful (free) service. It works 99% of the time (the 1 percent failure likely due to me).
It is more akin to magic than something I can understand fully. Also, Android handles this differently from 2.3 to 4.4.2 (as I have noticed).

I have example code if you need.

Thanks
 

schimanski

Well-Known Member
Licensed User
Longtime User
Hello!

Ich have two questions about the GCM. Perhaps someone knows an answer:

1.) Is it a problem, when I change the packagename of my app, after some devices has registered on the GCM? I think, that all devices have to be registered again under the new packagename, but I don't know it.

2.) Google says, that it is possible to send up to 1000 messages at the same time:


But a push-mail can't be bigger then 4kb. Does anybody know, how much push-IDs could be send in one push-mail? I have tested it until now with up to 50 IDs in one push without problems, but I don't know, how much IDs one push can hold?

Thanks for help...
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…