Dear friends..

I'm working on a project, which is simplified in making a program in Java for mobile phones that sends GPS coordinates as SMS..


Is there any open API for that? I'm using "Pulsar from Eclipse" with "Nokia SDK". It doesn't matter what kind of phone it'll work on, i'm just saying "Nokia SDK" just like that.

So, umm any help? or suggestions?

I have already the code that sends SMS, but I need to merge it with GPS coordinates locator to be able to send the coordinates through SMS.

Make sure, any information might be helpful to me. So, be generous "kindly" :)

Thanks in advance.

Dani AI

Generated

Yes — on Java ME you typically combine the Location API (JSR‑179) to get a GPS fix and the Wireless Messaging API (WMA / JSR‑120) to send the coordinates as SMS. Since you already have SMS code, add a LocationProvider, extract the QualifiedCoordinates, format them (decimal degrees or a maps URL), and send them with a TextMessage. (people.csail.mit.edu)

A compact flow to merge them:

  • request a location (single fix with a timeout or a LocationListener for continuous updates),
  • build a short payload like lat,lon (maps) so the recipient can paste/open it,
  • open a WMA MessageConnection and send a TextMessage. Use a background thread for both GPS lookups and sending to avoid blocking the UI. Some phones require specifying a port in the SMS address ("sms://+123456789:5000") or show user prompts for each send; test both styles. (people.csail.mit.edu)

A minimal sketch (run off the UI thread):

Criteria c = new Criteria();
c.setHorizontalAccuracy(500);
LocationProvider lp = LocationProvider.getInstance(c);
Location loc = lp.getLocation(60); // seconds timeout
QualifiedCoordinates qc = loc.getQualifiedCoordinates();
String sms = qc.getLatitude() + "," + qc.getLongitude()
           + " (http://maps.google.com/?q=" + qc.getLatitude() + "," + qc.getLongitude() + ")";
MessageConnection mc = (MessageConnection) Connector.open("sms://"+phoneNumber+":5000");
TextMessage tm = (TextMessage) mc.newMessage(MessageConnection.TEXT_MESSAGE);
tm.setPayloadText(sms);
mc.send(tm);
mc.close();

Remember permissions and signing: request location and WMA permissions in the JAD/MANIFEST and expect the MIDP security prompts; many devices require signed MIDlets to avoid repeated prompts or to gain full access. Also check that the target handset actually implements JSR‑179 and WMA — not all feature phones do, and emulators may need simulated GPS input. (docs.oracle.com)

Notes specific to this thread: you can reuse your existing SMS routine and insert the LocationProvider step before building the message; was right to point at J2ME location/SMS docs as the next step; , if you still need help, open a new thread with the device model, MIDP/CLDC versions, and the code you tried so responders can target device-specific issues. (people.csail.mit.edu)

Recommended Answers

All 4 Replies

Never did anything with midlet & GPS, but try to have look at these articles

PS: It doesn't matter what emulator or device you use as long you have access to appropriate libraries...

Thanks my friend :)

Dear Sir,


I have the same problem too . I need to develop j2me application that send the coordinates by sms . did you do it ,

thank you in advance for your help .

Waleed

Keep It Organized

  • Do not hijack old threads by posting a new question as a reply to an old one
  • Do provide evidence of having done some work yourself if posting questions from schoolwork assignments
  • Do not post the same question multiple times

So when you have something to show and discuss then you can create new thread.

Thread closed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.