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

I changed the date value I used and it worked. I’m trying to understand whats happening :confused:

In case the problem persists, please, create a new topic and describe the issue in details for us to be able to reproduce, investigate and fix it.

Thanks.

When I try to register device for the first time I got an exception :

BackendlessFault{ code: ‘IllegalArgumentException’, message: ‘java.lang.Object[] cannot be cast to java.lang.String[]’ }

with the code below :

List<String> list = new ArrayList();

    list.add("default");


    Calendar cal = Calendar.getInstance();
    cal.set(2015, Calendar.JUNE, 9);


    Date specifiedDate = cal.getTime();


    Backendless.Messaging.registerDevice(WOperations.GCM_Project_Number, list,specifiedDate, new AsyncCallback&lt;Void&gt;() {
        @Override
        public void handleResponse(Void aVoid) {

But it also registers the device.

Hi Onur,

Any chance you could try the following method and let me know if it produces an exception for you:

public void registerDevice( String GCMSenderID, String channel, AsyncCallback<Void> callback )

Regards,
Mark

It’s getting more complicated for me. I don’t even call registerDevice function but for some reason, it registers the device. Is that possible?

No, it is not possible. Remove the device registration in console, run the program again and check in the console. Without the call, your device would not get registered.

In my code I had this code block :

gcm = GoogleCloudMessaging.getInstance(this);

@Override
protected Object doInBackground(Object… arg0) {…
GCM_RegisterId = gcm.register(WOperations.GCM_Project_Number);
…}

When I run this code it also reigsters device to backendless console (without running anything else) as I believe :slight_smile:
But I dont think I need this code if I run registerDevice kcode of Backendless Messaging right?

Have you been having this additional logic in your code for all the time previously?
When using Backendless Messaging, you don’t need to deal with Google Cloud Messaging at all. Futhermore, you would better not deal with it, because this may produce some unexpected results, since Backendless Messaging also uses it under the hood.

OK, I will delete the additional logic then.
Thank you for the information. I will inform if I see an unexpected behavior.
Regards

If we return to the original problem,

I am still getting the exception :

BackendlessFault{ code: ‘IllegalArgumentException’, message: ‘java.lang.Object[] cannot be cast to java.lang.String[]’ }

with the code below :

List<String> list = new ArrayList();

list.add(“default”);

Calendar cal = Calendar.getInstance();
cal.set(2015, Calendar.JUNE, 9);

Date specifiedDate = cal.getTime();

Backendless.Messaging.registerDevice(WOperations.GCM_Project_Number, list,specifiedDate, new AsyncCallback<Void>() {
@Override
public void handleResponse(Void aVoid) {

But if I try public void registerDevice( String GCMSenderID, String channel, AsyncCallback<Void> callback ) there is no problem.

I really want to extend the expiration date for devices so it’s necessary for me to use the previous function signature. I need your help fixing this.

Thanks a lot

Could you please copy the stacktrace from LogCat, if any?

Since exception is on your side, I don’t have any stack trace sent, all I have is BackendlessFault object that I attached.

Hi,Can you re-create this issue yourselves? Can I expect it to be resolved soon?
Thanks

Hi,

Is there an update about this issue? Or you prefer keeping expire date of devices maximum 2 days?

Hi Onur,

Just to make sure I understand the problem. You need to be able to extend device registration. Is that correct? And if you use the method signature which has the “expiration” parameter, you get an exception from the server. Please confirm.

Regards,
Mark

Yes confirmed.

is it solved ?