Set Notification causing error

Md Azharuddin 8 years ago

I have updated the traccar to latest versions and after that it is causing this error

Unknown column 'userid' in 'NEW' - MySQLSyntaxErrorException (... < QueryBuilder:477 < DataManager:457 < BaseObjectManager:96 < ...)

when i checked my database there was no userid column in notifications table but earlier that column was there.
Should i add user id column by alter Query?

Anton Tananaev 8 years ago

You need to find out what happened. Did it fail to upgrade database scheme the first time?

Md Azharuddin 8 years ago

I have never updated the traccar before this
I was using 3.11 before that this was the first time
anyway what should i do now should i add that field in table?

Anton Tananaev 8 years ago

I suspect that your upgrade failed and you tried again, but database was already in invalid state. I would recommend to restore your 3.11 database backup and try again. If it doesn't work first time, you should check logs instead of trying again.

Md Azharuddin 8 years ago

Thanks Anton, I have restored 3.11 database backup and tried again and it is working now
One thing more i need to send a push notification to the users whenever any device exits geo-fence. I will run a cron job for that on my server.
Is there a way to find out user to whom i will send notification and that notification will be send only once.

Anton Tananaev 8 years ago

I don't really get the question. What exactly is the problem with finding user?

Md Azharuddin 8 years ago

I need to know how can i send push notification only once to the user if device exits geo-fence
is there any flag by which i can check notification has already been sent for the event or not

Anton Tananaev 8 years ago

I think you just need to set up event forwarding and then it will automatically be only once per notification.

Md Azharuddin 8 years ago
<entry key='event.enable'>true</entry>
<entry key='event.forward.url'>http://mywebsite/capture_event.php</entry>

I have set this in traccar.xml and tried to capture post data in my php page but i am getting nothing.

Anton Tananaev 8 years ago

Well, you'll have to investigate it and if you can't find the problem you would need to debug the code.

Md Azharuddin 8 years ago

Do i need to set <entry key='event.forward.header'> if yes then what should be the value?

Anton Tananaev 8 years ago

Please read documentation and use search before asking any questions.

Md Azharuddin 8 years ago

i am always getting 1 as json post data

Md Azharuddin 8 years ago

i have also tried to forward position data by

<entry key='forward.url'>http://mywebsite/capture_position.php?id={uniqueId}&deviceId={deviceId}&valid={valid}&fixTime={fixTime}&deviceTime={deviceTime}&protocol={protocol}&name={name}&latitude={latitude}&longitude={longitude}&altitude={altitude}&speed={speed}&course={course}&statusCode={statusCode}&address={address}&gprmc={gprmc}&attributes={attributes}</entry>

but that is also getting 1 as json post

Anton Tananaev 8 years ago

It's not from Traccar.