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 に答える