Beaconstac / NearBee-iOS-SDK

Beaconstac NearBee SDK for iOS
https://www.beaconstac.com
MIT License
1 stars 1 forks source link

Getting Beacon serial number from notification #6

Closed JoeyBodnar closed 5 years ago

JoeyBodnar commented 5 years ago

Beacons have the following properties available on iOS:

eddystoneURL
eddystoneUID
physicallWebDescription
physicalWebEddyStoneURL
physicalWebIcon
physicalWebTitle
physicalWebUpdated

Judging from this, it does not appear possible to get the serial number of a beacon inside the app. Is there another way I haven't noticed?

Thanks

sachinmobstac commented 5 years ago

@JoeyBodnar, eddystoneUID is the serial number of the beacon.

JoeyBodnar commented 5 years ago

We logged the value of eddystoneUID and it contained more info that just the serial number. The string did contain the serial number, but the serial number was only part of a long string of other random letters/numbers. Is there a way to specifically get just the serial number?

sachinmobstac commented 5 years ago

The last 12 characters of eddystoneUID is the serial number of the beacon. You can extract the serial number from that.

JoeyBodnar commented 5 years ago

I am trying to get the eddystoneUID from the beacon but it is reading as nil. I should note, I am trying this from the func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse method. This is what I'm trying

response.notification.request.content.userInfo["EddystoneUID"]

However the value is nil. response.notification.request.content.userInfo["EddystoneURL"] works for the URL though.

sachinmobstac commented 5 years ago

@JoeyBodnar, The notification object doesn't have the EddystoneUID and the UNNotification has only EddystoneURL. Is there any requirement for the serial number?

JoeyBodnar commented 5 years ago

oh. Yes, we are trying to cache the beacons so the user can go back and view the data associated with them, and to do so we need the serial number since that is what can connect a beacon to our object. So there is no way to get this info when opening the app from a notification?

ravipratapm commented 5 years ago

Is the data the user going to view from your app or the campaign that you're running via the Beaconstac dashboard? The reason I ask is because the campaign may change later.

If you want to cache the actual campaign that was running at that time, the URL will suffice.

JoeyBodnar commented 5 years ago

It is data from our app.

JoeyBodnar commented 5 years ago

Is there any way to pass any custom information in this method? Or EddystoneURL is the only thing we get and that cannot be changed?

JoeyBodnar commented 5 years ago

Is there any way at all possible to get any of these properties from the notification?

eddystoneURL eddystoneUID physicalWebDescription physicalWebEddyStoneURL physicalWebIcon physicalWebTitle physicalWebUpdated

or pass any other data to the notification? Or the EddystoneURL is the only thing we have access to?

sachinmobstac commented 5 years ago

@JoeyBodnar, You cannot pass any data to the notification object. You can only read from it. I am working on fix, will release it soon. Do you need all these properties or just the eddystoneUID?

JoeyBodnar commented 5 years ago

just the eddystoneUID is fine, not all of them. As long as I can get the serial number then that will be good enough. Thank you!

JoeyBodnar commented 5 years ago

when should the new version be released? is there an estimated date?

sachinmobstac commented 5 years ago

@JoeyBodnar, I have released the new version 2.0.0.

JoeyBodnar commented 5 years ago

thank you! will try it now.

JoeyBodnar commented 5 years ago

I just updated to v2.0 and I am getting an error on this line:

let isNearBeeNotification = nearBee.checkAndProcessNearbyNotification(response.notification, queryParameters: ["authToken" : authToken])

The error says "Extra argument 'queryParameters' in call". How are we supposed to pass the query parameters then?

sachinmobstac commented 5 years ago

Hi @JoeyBodnar, Sorry few commits got reverted somehow. I have updated the source. You have to run the following commands

rm -rf Pods rm -rf Podfile.lock pod cache clean 'NearBee' --all pod install

JoeyBodnar commented 5 years ago

ok thanks, will try it now!