I’m developing an app, and we are now in the push notifications implementation stage. I have a question: how can I get a unique ID from a device? Let me explain the context:
Users can access more than one account on the same device. Because of this, do I need to request permission for push notifications every time a user logs in to a different account?
Does Bubble provide any tool or method to get a Device ID so I can create a condition to know whether I need to ask for push notification permission or not?
Basically, I just want to know if it’s possible to check something like: “Has this device already accepted push notifications?” If it has, then I won’t show the permission popup again. How could I retrieve this information?
I know it. My question is, how can I get the information that this device is already registered for other user account before I request the push notification permission?
Because when the user switch accounts, I need to know if system needs to trigger the push notification workflow again (warning popup request > push notification native request), because even it is more than one account its only one device.
you can store the device token in your database when the user first grants push notification permission. create a field in your user table or a separate device table to save the push token.
when a user logs in, check if there is already a push token stored for that device. if yes, you dont need to show the permission popup again. if no token exists, then trigger your push notification workflow.
for the device id part, bubble mobile gives you access to device info through the app data. you can use current device or app info to get a unique identifier and store it along with the push token.
so basically your logic would be on login check if device token exists in database then skip permission request else show the permission popup and save the new token.