0

如何以编程方式通知设备在 Android GPS 中的错误方向。我有一个默认路径设置。我已经设置了这样的路径:

final Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?" + "saddr="+ 12.756742 + "," + 76.67523465 + "&daddr=" + 12.64345213 + "," + 76.875432));
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.MapsActivity");
startActivity(intent);`

从一个点移动到另一个点时,设备应该只移动到该路径。当用户移出该路径(例如向右或向左 + 或 - 100 米)时,它应该通知用户。

先感谢您。

4

2 回答 2

1

我想这个链接可以帮助你

“http://developer.android.com/reference/android/location/LocationManager.html#addProximityAlert(double, double, float, long, android.app.PendingIntent)”

将其粘贴到不带引号的地址中。

于 2012-09-11T06:26:40.080 回答
0
            NotificationManager notificationManager = (NotificationManager)  getSystemService(NOTIFICATION_SERVICE);

    // Create Notifcation
    Notification notification = new Notification(R.drawable.ic_launcher,
            "A new notification", System.currentTimeMillis());

    // Cancel the notification after its selected
    notification.flags |= Notification.FLAG_AUTO_CANCEL;
    //

    // Specify the called Activity
    Intent intent = new Intent(this, ur_activity.class);

    PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0);
    notification.setLatestEventInfo(this, "your tittle",
            "ur notifi text", activity);
    notificationManager.notify(0, notification);

并在 onLocationChanged(); 中使用它 你可以在你是否处于良好状态时处理。(你可以检查纬度和经度。)

于 2012-08-27T08:12:53.933 回答