Missing Device Registration

Hi,

Just checking again for an update on this issue.
Been about 6 days and just wanted to see if I could at least find out what the issue was or what’s being done to fix it.
It’s quite a major issue for our live application currently.

Innocent.

Hi. Could you clarify, is it possible that the device registration request is sent from a non-authenticated user? In such a case the record in the DeviceRegistration table is created without relation.

And another question – what is the device type we are talking about? Android/iOS?
What SDK version are you using?

I don’t believe it’s possible based on how we have things set up.
We have users confirm their emails before they can login and it’s an iOS only application.

Would that possibly mean the user object creation on registration but before email confirmation could be causing an issue?

Hi @Innocent_Nwaukwa

our iOS developer will take a look into the issue as soon as possible

Wonderful!
Thank you.

I’ll check again in two days.
Just really want to find the best way for us to communicate so this can be resolved ASAP.

Hello @Innocent_Nwaukwa,

I’d like to ask you to share the part of the code with user and device registrations (do you use Swift-SDK for device registration?).
You said you don’t use any SDK but the REST endpoints and unfortunately we cannot reproduce it without the detailed steps.

We do our iOS development using swift and this is what our endpoint looks like:

We call this endpoint on the backend and on success, give a pop up to the user that they should receive a confirmation email.
You’re free to inspect our backend or that endpoint but when we make the call to this endpoint, the user object gets created without issue.

Referencing the issue itself:
Device registration relation is only added for some users, not all when they log in (unsure if the device registration object just doesn’t get created sometimes because I don’t believe we explicitly call to create those objects).
Correct me if I’m wrong but I haven’t noticed any area where we are explicitly calling the DeviceRegistration API and even if, why the inconsistency?

Eg:
User 1 logs in, device registration object is assigned to user 1’s user object.
User 2 logs in, device registration object is not assigned to user 2’s user object

It’s inconsistent we aren’t sure why.

  • in order to create a DeviceRegistration object you need to run our API, without that there is no way that someone creates the object

  • registering a new user is not related to the creating DeviceRegistration object, for instance, you can register a device for PushNotification for not logged in user and in this case there won’t be a relationship between that device and a user

  • so the most important thing is to figure out when/where you register a device

do you use our iOS-SDK or do you use REST to register the device?

if you use our SDK you should find this code

DeviceRegistration

We use REST.

Do you need any further information for clarification?

Hello @Innocent_Nwaukwa,

If I understood correctly, you use Swift-SDK in your client’s iOS application and also call the Backendless service methods from the client’s code (e.g. to register user).
I also need to clarify - do the devices appear after the user registration or after login? (Those are the different methods).

As @vladimir-upirov said the registerDevice method uses the user-token of the logged in user. This method is usually called from the AppDelegate.swift class, so it could be executed earlier than user is logged in.

So, in case you have the already logged in user with the enabled stay logged in option, that user’s token will be used the next time user opens the app, and the user-device relation will be created.

Otherwise, if user opens the app before he/she is logged in, the device still will be registered but without the user relation. That relation will be created later when the logged in user reopens the app.

That’s how it works but unfortunately I cannot provide more information without the step by step instructions (or code sample) of methods call sequence in your client iOS app.

Thank you so much for the comprehensive reply.
I didn’t write the frontend code but just found the backend inconsistency unusual and assumed it was a backend issue.
I’m in contact with the developer and will ask further questions if necessary.
Otherwise, I’ll mark this thread as resolved.

I’ll keep you posted.

1 Like

Turns out users were not allowing notifications but we still attempted to send them.
Since they didn’t authorize notifications, their user objects weren’t being assigned to deviceRegistration objects.
Just need to handle that use case on our backend and everything should work smoothly again.
Thanks for the insight @olhadanylova !

Innocent.

1 Like

Thanks for your response, I’m glad you’ve found that out!

1 Like