Create New Device Identifier and Add it to the Server

LoadManager7 years ago

Hi Anton,
Using the open source and/or the Traccar API is it possible to create a web app that will create the Device Identifier and then add it as a Device on the Traccar Server?
The idea is to have our web app provide a smart phone user with the option of registering their phone as a device with the Traccar Server without having to install the Traccar Client and without then manually entering the Device Identifier into the Traccar Server.

If it is not possible with the current source code or with the current API can you modify the source code and/or API to provide this capability?
Regards,
Scott

take a look at this it might help u - demo.trackcentral.in

LoadManager7 years ago

Thank you karthiksg,
When I click on Add Device it is prompts for various fields including a unique ID. I was not sure what to enter so I made up some values and added the device. When finished I wanted to see if my phone was added as a device so I looked at the "Track Device Live" option but it came up blank. Was I supposed to enter in a valid SIM#?

My objective is not to require the user to enter in any sim or imei or anything but to just click a button to add the device to the traccar server.

you have to use traccar mobile client and need to feed the unique id mentioned in the app
without feeding configurations its not possible to monitor a device by the server.
in someway you have to feed.
May be programatically can customise traccar mobile client and manager to integrate with auto generated unique id on both the sides, there are concepts

But this is not the right forum to discuss here.
We need to abide the forum rules.

LoadManager7 years ago

Ok understood. I am looking to do the later. What is the appropriate forum for programmatically customize Traccar to accomplish this?
I am thinking I need to wait for Anton to chime in but if you can help further I would appreciate it.

you can wait for anton`s reply and if you need any help from me, then you can check my profile and contact thru that, thanks

LoadManager7 years ago

Ok thank you.
I will wait to hear from Anton.

LoadManager7 years ago

Anton,
Just another thought here. If I programatically create a new record in the devices table with proper values, would I be able to use the traccar client api (or source code) to apply the uniqueid of the record I created to track it's location and store data in the positions table?
Sorry if this doesn't make sense, I am just exploring some options here just in case modifying source code turns out to be difficult or not possible.

Malkit Singh7 years ago

@LoadManager you can do this using API's. I built a similar solution which you are trying to build.
Here is link to API's https://www.traccar.org/traccar-api/

LoadManager7 years ago

Thanks Malkit. What API do I call to create the Device Identifier? What API to I call to create the Device in the Traccar server?
I was thinking the "POST /devices" call would be used to Create a Device which would also give me a Device Identifier but I was not sure if it would give me a Device Identifier. Also I did not see any function to Add the device to the traccar server.

Malkit Singh7 years ago
  1. There is no such service which creates device identifier.
    Usually, you will be entering device IMEI number in device identifier which means you can not create device identifier of your own (unless you are not using the traccar client app, there you can choose your own identifier)
  2. You call to http://your-server.com/api/devices to create a new device in the traccar server. It will be POST type service.
  3. Not sure what you meant by "function to Add the device to the traccar server."
LoadManager7 years ago

Thank you for the reply and clarifying the POST service.
If there is no service to create the device identifier then I am willing to work with the source code if that is an option.
I am looking forward to hearing from Anton before deciding how to proceed.

Malkit Singh7 years ago

The device identifier can be any random combination of integers. You can generate a random set of integers just before calling this add device service.
If it's a unique and doesn't exist in traccar then you will get 200 response code, and if exists in the system earlier then you may get bad request or some other response code.

Anton Tananaev7 years ago

Malkit Singh is correct. Device identifier can be anything you want.

I'm confused by "without having to install the Traccar Client". If you don't have Traccar Client on your phone, you won't be able to track it. What's the point of registering device then? What is the device id for?

I think you should explain what you are trying to do.

LoadManager7 years ago

Thanks for the response Anton.
What we are trying to do is to automatically install the Traccar Client with the click of a button from within our web app. Then while still within our web page we want to add the new device to the Traccar Server.
The reason is because the user we are targeting is often a 1 time user that will not install the Traccar Client and then tell us the device identifier. However if we give them a URL with the delivery information and terms they are willing to open that and click a button to accept the terms. this is the trigger we want to use to start tracking the driver with the delivery they are working on.
Here is a video which show you the process I am describing.
https://youtu.be/t6xd8Yqn6b0