NetTalk Central

Author Topic: Get DeviceID  (Read 3145 times)

agustinh2000

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • Email
Get DeviceID
« on: December 04, 2018, 02:48:29 PM »
Hi Bruce

How can I get the deviceid (requested) and then filter the view to send that device only the necessary data?
(in disconnected web)

attached image

thanks!

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Get DeviceID
« Reply #1 on: December 06, 2018, 03:10:43 AM »
Hello,

The problem is that the device ID is created on the client side when the app initially loads.  That record is stored in the browser's IndexedDB local storage as the _first_ row.  So, out of the box, you're not going to know what that device ID is going to be on the server side (at first). 

However, that device ID IS stored server side in your single settings table and you could use that device ID in a filter. 

So, this is what I do....

I have two tables involved in my disconnected web app's authentication, the single settings table and my user's table.  When the user first loads the disconnected app and enters their credentials, a POST to the sync server is made with their Username and Password sent as parameters to the WebHandler's p_web.Authenticate method.  I validate the passed Username and Password against my User's table.

Now, here is where you could grab that device ID.  If the passed Username and Password validate, store the deviceID in that User's record.  Now you know that device ID goes with that user.  Side bar on that though is that the user can have multiple, dare, numerous devices so you may need a child table (User>->>Devices) to store that user's devices.  Once you have that sorted out you can control who get's what in the Sync Methods.   

I don't know if you have a NetTalk Progressive Web App currently up and running but it is INCREDIBLY cool!  Most people outside of the tech world have never heard of it.  Yesterday afternoon, I used mBuild to create an iPhone app, an Android app, and a PWA in just a few minutes.  Brought my Sergeant in and he happened to have an iPhone and Android phone with him.  With my phone and his two phones, I demonstrated the iOS app, Droid app, and PWA side by side and you couldn't tell the difference.  It's just freaking cool!  What Bruce has done with the disconnected app stuff is a great credit to him and Capesoft.

I'll be doing a walkthrough of a NetTalk created disconnected app during the ClarionLive weekly webinar on Friday, December 21st.  Bruce should be there as well.  This would be a great opportunity to ask questions.

See ya,

Don
« Last Edit: December 06, 2018, 03:17:22 AM by DonRidley »
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

agustinh2000

  • Jr. Member
  • **
  • Posts: 86
    • View Profile
    • Email
Re: Get DeviceID
« Reply #2 on: December 06, 2018, 05:59:12 AM »
Thanks Don for all the comment, it has helped me a lot.
I commented that if I'm using the thisdevice table to get the data from the device, but since I want to do the filter on the server side I wanted to detect who requests to generate a view only for that request and not have to send all the content to not fill the localstorage. Then I want to capture the clientID and prepare its data for shipment.

I will be ready for Friday the 21st!

regards!

Jane

  • Sr. Member
  • ****
  • Posts: 349
  • Expert on nothing with opinions on everything.
    • View Profile
    • Email
Re: Get DeviceID
« Reply #3 on: December 06, 2018, 07:57:03 AM »

I'll be doing a walkthrough of a NetTalk created disconnected app during the ClarionLive weekly webinar on Friday, December 21st.  Bruce should be there as well.  This would be a great opportunity to ask questions.


Very much looking forward to the webinar, Don.

And thanks so much for your work on mbuild!

Jane

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Get DeviceID
« Reply #4 on: December 07, 2018, 02:28:04 AM »

Very much looking forward to the webinar, Don.

And thanks so much for your work on mbuild!

Jane

Thanks Jane!  I'm very appreciative that Bruce gave me a chance to help. 
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11