If you take source code from GitHub, it already has required headers. Here is a new build:
https://www.dropbox.com/s/myt68q5u7fiz49r/tracker-server-jar-with-dependencies.jar?dl=0
I have replaced the old one with your .jar on my server but I still got the following line in the console
"XMLHttpRequest cannot load http://xxx/api/device/get. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access."
Am I missing something?
Just look at the headers and see if it's there.
Thank you, I have got it done!
I would like to ask another question, how can I config to let several accounts having same unique Id that generated by app client to view on the web server?
For example :
Acc A can add and view unique id 1234, 2345,4567
Acc B can also add and view unique id 1234
Acc C can also add and view unique id 2345
Sharing device will be available with next release. If you don't want to wait, you can try to compile Traccar from source. It's already implemented.
Hello,
I tried compiling latest Traccar source using Netbeans, and ran server successfully. The latest version still displayed error if I added same device id in different accounts, was I missing something?
What's the error?
I added the same device id to track and the following errors displayed :
"Unique index or primary key violation: "CONSTRAINT_INDEX_7 ON PUBLIC.DEVICE(UNIQUEID) VALUES ('891542', 1)"; SQL statement: INSERT INTO device (name, uniqueId) VALUES (?, ?); [23505-187] - JdbcSQLException (... < QueryBuilder:424 < DataManager:300 < DeviceServlet:75 < ...)"
It looks like you are trying to add a second device with same unique id.
Yes, I asked you about this feature above, and "Sharing device will be available with next release. If you don’t want to wait, you can try to compile Traccar from source. It’s already implemented.", you said.
I would like to give different accounts the ability to track same device, is it possible for the git version?
Yes, but you need to SHARE the device using special screen (Settings->Users->Devices) in the web interface, not by creating a second device with same unique id.
Hello,
Has anyone succeeded in config 'access-control-allow-origin' header on the web server, I need some help to do this, please give me some advice!
Have a nice day.