否则,如果两个用户具有相同的应用程序,则他们应该将其位置(从 Cell ID 或 GPS 获得)推送到 Web 服务器(您将处理该服务器)。然后,您可以使用网络服务交换位置坐标。作为参考,请查看此处表 1
检测 SMS 消息的代码
public class IncomingSmsCapture extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String data = "";
if (bundle != null)
{
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i=0; i<msgs.length; i++){
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
String sender = msgs[i].getOriginatingAddress();
data = msgs[i].getMessageBody().toString();
// parse the data and extract the location, then convert to an Address using the GeoCoder.
} } } }
You can never get someone elses location simply from the mobile number, that is like stalking.
Google provide a service called Latitude which is a much better, legal way of doing this.
Otherwise, if the two uses have the same application, they should push their location (obtained from the Cell ID or GPS) to a Web Server (which you will handle). You can then exchange the location coordinates using your web-service. For reference, have a look at the Table 1 over here
Code to detect SMS messages
public class IncomingSmsCapture extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Bundle bundle = intent.getExtras();
SmsMessage[] msgs = null;
String data = "";
if (bundle != null)
{
Object[] pdus = (Object[]) bundle.get("pdus");
msgs = new SmsMessage[pdus.length];
for (int i=0; i<msgs.length; i++){
msgs[i] = SmsMessage.createFromPdu((byte[])pdus[i]);
String sender = msgs[i].getOriginatingAddress();
data = msgs[i].getMessageBody().toString();
// parse the data and extract the location, then convert to an Address using the GeoCoder.
} } } }
Use CellID.A CellID is a number which is associated with a specific cell (the radio tower to which your handset is connected). In most cases, this is the closest tower to your location. So by knowing the location of this tower, then you can know approximately where the handset is.
发布评论
评论(2)
你永远无法仅仅通过手机号码获得别人的位置,这就像跟踪一样。
Google 提供了一项名为 Latitude 的服务,这是一种更好、更合法的方式。
否则,如果两个用户具有相同的应用程序,则他们应该将其位置(从 Cell ID 或 GPS 获得)推送到 Web 服务器(您将处理该服务器)。然后,您可以使用网络服务交换位置坐标。作为参考,请查看此处表 1
检测 SMS 消息的代码
You can never get someone elses location simply from the mobile number, that is like stalking.
Google provide a service called Latitude which is a much better, legal way of doing this.
Otherwise, if the two uses have the same application, they should push their location (obtained from the Cell ID or GPS) to a Web Server (which you will handle). You can then exchange the location coordinates using your web-service. For reference, have a look at the Table 1 over here
Code to detect SMS messages
使用 CellID。CellID 是与特定小区(手机所连接的无线电塔)相关联的号码。在大多数情况下,这是距离您所在位置最近的塔。因此,通过了解这座塔的位置,您就可以大致知道手机的位置。
为了更好的想法请看这里
将位置添加到非 GPS 手机:引入 CellID
现在,如果您知道您朋友的 cellId,那么您就可以知道他们的位置。另一种方式
开发基于位置的服务:介绍 J2ME 的位置 API
Use CellID.A CellID is a number which is associated with a specific cell (the radio tower to which your handset is connected). In most cases, this is the closest tower to your location. So by knowing the location of this tower, then you can know approximately where the handset is.
For better Idea Take a look at here
Adding location to a non GPS phone: introducing CellID
Now if you know your friends cellId then you can know their location.Another way
Developing Location Based Services: Introducing the Location API for J2ME