Open ochan opened 12 years ago
I do plan to support GCM, probably under a new name like gcm4j. I'll update the c2dm4j README with a link when that's released.
It'll take me a week or two to do the initial updates. I looked over the GCM spec last weekend, and it shouldn't affect the core of the library much. The primary changes will be (1) additional options for the data sent to GCM, (2) a few extra response/error types, (3) a new authentication method, and (4) handling the updated client identifiers returned with the responses.
+1 on this. I've written my server using C2DM4J and now I see that it's deprecated. I'd love to be able to move to GCM2J soon. I think that the collapse key is now optional, too.
OK, I've pretty much finished porting this to GCM. Let me know if you'd like what I did, if you haven't started yet.
Hi drblid, do you have any news from the GCM support? have you start?
Hi drblid, what is the status of the new GCM lib?
@nfranke : Can you upload your port to a github repo? We kind of need it since our C2DM suddenly stopped working. Thanks!
We stopped using C2DM/GCM for our product, so I haven't been able to officially spend anytime on this and I'm currently in the midst of trying to finish my dissertation.
If @nfranke can post his port, that should work at least for the features carried over from C2DM.
Handling the submission of multiple client recipients per GCM request requires some changes to the API (at the last time I worked on this, I was still floating around several APIs for this. None of them felt quite right to me) and so will be a bit more work. But if you just need to restore your C2DM functionality, that's not a problem.
Thanks, drblid. Good luck to your dissertation :). Waiting for nfranke's port :D.
@Dao007forever, out of curiosity, has Google shutdown C2DM for good? I thought it was still functional for existing users.
Oh, it's not, my email was deleted by the IT guy and when he restored it, I can still generate token, the push succeeds but there was no message. I guess when it was deleted, the removed the authentication for pushing.
I might as well spin off a new github project for this.
This is my first github project, so bear with me. I've checked what I'm using, after renaming the package.
Great. Thanks much.
@drbild I'm implementing the multiple registration_ids for the gcm4j and reading through your code. I wonder if the GlobalBackoff and DeviceBackoff is wrong in the updateDelay() method?
We should get the Attempt from the context and update the delay according to that Attempt, but you created a new Attempt every time, is there a reason for that since I'm not familiar with this flow of code (it's quite OS-like type of logic, where did you get those Context styles from?)
@nfranke What do you think?
I'm sorry if you found an email with this same content as I realized that you graduated and the email might be invalid so I post here.
@Dao007forever I believe the code is correct.
The Attempt
objects are immutable and essentially stateless. The actual current state of the backoff (i.e., the next delay) is maintained in the Backoff
object (see AbstractThreadSafeBackoff
). Creating a new Attempt
is correct and safe.
Attempt
is mainly just a callback interface, providing a way of emulating something like lambdas and closures in Java. The recordSuccess()
and recordFailure()
are the callbacks. It also holds references to the state of the Backoff
at the time the Attempt
was created (essentially closing the callback over that particular state). Why do this? To allow multiple in-flight attempts (e.g., for GlobalBackoffThrottle
, which is handling multiple concurrent attempts). When the recordSuccess()/Failure()
methods are called, Backoff
verifies that the State
in the attempt matches the current State
, before updating the state. If it doesn't match, it means some other newer Attempt
has already updated the state and thus this one shouldn't.
I did get your other email, but this issue tracker is better anyway, because it's publicly visible.
(I'm not sure where I got the Context
style from. It (or similar styles) are fairly common in a variety of open-source projects I've looked at over the years.)
FWIW, the use of immutable State
and Attempt
objects leads to a lot of garbage collection churn, which might be a problem in some use-cases. But for what I was doing, GC wasn't an issue and the bug reduction afforded by immutable objects was desirable.
@drbild Thank you for your explanation, it becomes clearer now :+1:.
@Dao007forever Glad to help. I'd love to see gcm4j support the new GCM features (and I wish I had the time to help make that happen!).
Hi,
The c2dm service has been deprecated ( https://developers.google.com/android/c2dm/ ). Do you have any plans to support the new service GCM ( http://developer.android.com/guide/google/gcm/index.html ) ?
Thanks so much for this library. The implementation is very elegant.