#sendLocation

9 messages · Page 1 of 1 (latest)

late wedge
#

I'm having a problem sending location to android devices, even sending the coordinate the card sends it to a random place, but this is only on android devices, I'll leave examples on the web, IOS, android if you can help me I'd appreciate it @unique carbon

unique carbon
late wedge
#

Basically that's it, the lat and long I'm receiving from a json in string format so I'm transforming it into a number, so while I can't find the solution I made the code check the device type

#

Note: I'm not a programmer yet, I've been in college for less than a year

late wedge
#

entire code or just the part that uses location?

unique carbon
late wedge
#

result.forEach((r) => {
const { nome, av, lat, long, id } = r
if (!nome || !lat || !long) {
message.reply("Ops! Algo deu errado.")
return;
}

    const diasRestantes = calcularDiasRestantesloc(remetente)

    var latitude_f = parseFloat(lat);
    var longitude_f = parseFloat(long);

    const deviceType = message.deviceType;

    if (deviceType === 'android') {
      message.reply(`🐓 ${nome} (av ${av ? av : "desconhecido"})\n\nhttps://www.google.com/maps/search/?api=1&query=${lat},+${long}\n_Localização errada? me avise mandando_ *!ajuda*\n\nFaltam [${diasRestantes}] dias para seu acesso expirar.`)
    } else if (deviceType === 'ios') {
      message.reply(new Location(latitude_f, longitude_f, { name: `🐓 ${nome} (av ${av ? av : "desconhecido"})`, address: `Localização errada? me avise mandando !ajuda Faltam [${diasRestantes}] dias para seu acesso expirar.` }))
    } else if (deviceType === 'web') {
      message.reply(new Location(latitude_f, longitude_f, { name: `🐓 ${nome} (av ${av ? av : "desconhecido"})`, address: `Localização errada? me avise mandando !ajuda Faltam [${diasRestantes}] dias para seu acesso expirar.` }))
    } else {
      console.log('O dispositivo do usuário não foi identificado.');
    }