aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java
blob: 99543823ed3d19e36371d9a48fc198d902944846 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cgeo.geocaching.apps.cache.navi;

import cgeo.geocaching.R;
import cgeo.geocaching.location.Geopoint;

import android.app.Activity;
import android.content.Intent;

class NavigonApp extends AbstractPointNavigationApp {

    private static final String INTENT = "android.intent.action.navigon.START_PUBLIC";
    private static final String INTENT_EXTRA_KEY_LATITUDE = "latitude";
    private static final String INTENT_EXTRA_KEY_LONGITUDE = "longitude";

    NavigonApp() {
        super(getString(R.string.cache_menu_navigon), R.id.cache_app_navigon, INTENT);
    }

    @Override
    public void navigate(final Activity activity, final Geopoint point) {
        final Intent intent = new Intent(INTENT);

        /*
         * Long/Lat are float values in decimal degree format (+-DDD.DDDDD).
         * Example:
         * intent.putExtra(INTENT_EXTRA_KEY_LATITUDE, 46.12345f)
         * intent.putExtra(INTENT_EXTRA_KEY_LONGITUDE, 23.12345f)
         */
        intent.putExtra(INTENT_EXTRA_KEY_LATITUDE, (float) point.getLatitude());
        intent.putExtra(INTENT_EXTRA_KEY_LONGITUDE, (float) point.getLongitude());

        activity.startActivity(intent);
    }
}