Support Topics Documentation Slack YouTube Blog

Device Registrations are Erased from the 'Devices ' Section Even after Putting enough Expiry Date

Hello Backendless,
I am noticing that my Registered Device on the Default Channel as well as the Custom Channel gets Disappeared after 2 or 3 days of times or even less than that . I tried putting Expiry date on the Registration and my code came up with something Like :

Date expiratioNDate=new Date();
expiratioNDate.setYear(2080);
Backendless.Messaging.registerDevice(Application.gcmSenderID,channel,expiratioNDate

But , the Problem is that with the Expiration date of Even 2080 , it gets expired ( or Deleted ) after few days.
I am not understanding why is this Happening after all
Regards,
Pujan

Hi @Pujan,
The issue described above is more of an issue of a Google Push Services rather than of the Backendless. We can suggest you renewing your device registration.
Artur

Hello @Artur Dzidzoiev
I am not gettting to see the Device Id in the Registered Console too . Does that implies It’s the Problem of Google Push Services ?

I kept my devices registered for about 3 weeks of inactive use…check out this.

//register mobile device for backendless push notifications
Date expiringDate = new Date(System.currentTimeMillis() + 1987219780); //keep device registered for a 3 weeks
if (isNetworkConnected()) {
Backendless.Messaging.registerDevice(gcmSenderId, channels, expiringDate, new AsyncCallback<Void>() {
@Override
public void handleResponse(Void aVoid) {
// Toast.makeText(MainActivity.this, “Device registered”, Toast.LENGTH_LONG).show();
}

            @Override
            public void handleFault(BackendlessFault backendlessFault) {
              // Toast.makeText(MainActivity.this, backendlessFault.getCode(), Toast.LENGTH_LONG).show();
            }
        });
    }

Hello @ Ps Jimmy :

Thanks For Your Comment . Okay , I took a look at your Code and Are there any other ways that We could lengthen the 3 Weeks Span you have purposed above. And How can we be so sure that : It will last 3 weeks even after the inactivity. Meanwhile , If you could take a look at my Code Also : I kept the expiring date at 2080 , which ain’t working . Why might it be so ?
Regards,
Pujan

The only advice we can give you now is to call registerDevice() each time the application starts, this will guarantee that the registration is always present when needed.

Hello Sergey Chupov
Okay , That is some sort of Alternative : But If a User is subscribed to Suppose 1000 channels : It would cost him a lot of Data to register the Device . Isn’t it ? My Concern was regarding the data After all :slight_smile:

Sergey is right. That is what i do for now. If you have more channels to subscribe to, just pass them into an arrays as List and subscribe all for one time when app runs.

Jimmy is right, you can register a device to any number of channels with only 1 API call, and it won’t affect performance much.

@Sergey Chupov and @ Ps Jimmy
Thanks for the Neat communication .
Okay . I got it . I shall Try Registering with Multiple Channels and Share the Data consumed as per the number of Channels.
Regards,
Pujan

Hello Ps Jimmy
As You have Mentioned You used the following Code Snippet to keep the User subscribed to the Channel even after 3 Weeks of Inactivity :

 Date expiringDate = new Date(System.currentTimeMillis() + 1987219780); //keep device registered for a 3 weeks 
 if (isNetworkConnected()) { 
 Backendless.Messaging.registerDevice(gcmSenderId, channels, expiringDate, new AsyncCallback&lt;Void&gt;() { 

Are You Sure / Validated from your part about the 3 Weeks Span ? As it would give me a picture about when Should I Re-register my devices to the Channel.
And , Sergey Chupov : Are there any sorts of Suggestions from the Backendless Team That When Should I be re-registering the Devices to the Channels . ? ( I am iterating over this thing because I have a quite a few number of Channels and bit concerned about Data ) . So , I would be really really grateful .