Registering Device; "expiration" parameter doesn't work (android)

I try to register my device with a specific expiration date. I have this code below. Registered device parameter is not the same as my value. It’s always 2 days later of the current date. In this case, devices won’t be able to get my push after 2 days. What can I do ?
List<String> list = new ArrayList.();
list.add(“default”);
Calendar cal = Calendar.getInstance();
cal.set(2016,9,9);
Backendless.Messaging.registerDevice(WOperations.GCM_Project_Number, list, cal.getTime(), new AsyncCallback<Void>() {…}

Hi, Onur,

I’m afraid I failed to understand your issue correctly, could you please clarify it a bit: tell me what you want to do and what step is failing on your way to achieve it?

In your code sample, you set the expiration date to October, 9 in 2016. Could you please check what value do you get in Devices -> Expiration field on Messaging tab of Backendless developer’s console for the device registered with this code? It should be like 1476019972000.

I deleted my device and retried the code I wrote above. The value expiration is 1422199092000 and it’s not correct. That’s my issue.

The value you get corresponds to January, 25, 2015.
If you want to set October, 9, 2016, try using the following code:

Calendar cal = Calendar.getInstance();
cal.set( 2016, Calendar.OCTOBER, 9 );

I deleted my device again and tried with the code you provided. But on backendless console I got 1422200586000 as my expiration value. I don’t think the method uses expiration parameter properly.

That’s strange, because I’m getting proper value on console with the same code.
Could you please check in some way what date does cal.getTime() return at runtime?

Hi again,
I re-created the problem and attached screenshots. I took the first one on debug mode. You can see the generated value under “specifiedDate” object’s “miliseconds” instace. Then I checked the backendless console and the value is 1422446619000 which corresponds to Wednesday, January 28, 2015 7:03:39am

Could you please specify your timezone?

Sure, it’s GMT+2 , Istanbul.

Just to be sure, are you using the latest Backendless AndroidSDK?

Yes.

Hi,Is there an update about this issue? It’s a bit critical for me because I’m waiting for this to be resolved before releasing my app. Otherwise users won’t be able to get push notifications after 2 days.
Can we also check is it possible not to include an expiration value? I tried to send null as date but it didn’t work.

It used to save values without the expriration value with the signature below :

public void registerDevice(java.lang.String GCMSenderID, java.lang.String channel, com.backendless.async.callback.AsyncCallback<java.lang.Void> callback) { /* compiled code */ }

But when I saw the expiration value I tried to use some large expiration interval with the other signature.

Hi Onur.

I created an internal task and our developers will look into the problem.
We will add changes as soon as possible.

Regards,
Kate.

Hi, Onur,

The issue is fixed in the new version of Backendless AndroidSDK (v1.13). In this version you can specify the expiration date or it will be defaulted to 2 days from the moment of registration if you don’t.
So to make your code work as expected, please, update Backendless AndroidSDK from https://backendless.com/backend-as-a-service/downloads/

Thanks for reporting this issue!

Regards,
Sergey

Thank you for resolving the problem, it now works as expected.

Regards

For some reason again, I don’t think it works now.

What’s the problem?

The same problem. In the morning it was OK now it seems date is always 2 days from the moment even if I specify one.

Is it possible for you to try uninstalling the application from the device and then checking the problem again with clean install?

I did that but it didn’t work. I used same device as I saw the correct value this morning. I also checked with another device.