2011-02-04 8 views
3

私はこれが初めてです。私は私の連絡先を見つけるアンドロイドのアプリケーションを作成しています。私はいくつかのチュートリアルを試して、それが実行されます。 Googleマップを置き換えて街路図を開く方法。私はこのコードを持っています。Googleマップを置き換えて街路図を開く

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.PositionLocator.android"> 
<application android:icon="@drawable/icon"> 
<activity android:name=".PositionLocator" android:label="@string/app_name"> 
</activity>   
<activity android:name=".PositionLocatorMap" android:label="@string/app_name"> 
    <intent-filter> 
    <action android:name="android.intent.action.MAIN" /> 
    <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 
</activity> 
<uses-library android:name="com.google.android.maps"/> 
</application> 
<uses-permission android:name="android.permission.INTERNET"/>  
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> 
<uses-permission android:name="android.permission.READ_CONTACTS"/> 
</manifest> 
+1

だから、あなたの問題/質問は正確には何ですか? – Adinia

+0

@adinia Googleマップをopenstreetマップに置き換えるにはどうしたらいいですか? – gutentag

答えて

3

私は今までオープンストリートマップについて聞いていないが、単純な検索は、あなたがそれのためにAPIを見つけることができます自分のページに私をリード。

また、hereでは、Open street mapを実装しているAndroidアプリケーションのコードを見ることができます。

+1

リンク先の "OpenStreetMap API"は、OpenStreetMapデータの低レベル編集操作をサポートするためのAPIです(OpenStreetMapエディタを開発していた場合)。それは確かにアンドロイドAPIやウェブマップ埋め込みAPIではありません(別のよくある誤解)。あなたは他の場所を見なければなりません。 –

+0

@HarryWoodこれを指摘していただきありがとうございます。私の答えで述べたように、それは簡単な検索の後で私が見つけたものでしたが、実際に使ったことはありませんでした。あなたが他の役に立つリンクを知っているなら、あなたは私の答えを編集したり、まったく新しいものを投稿したりすることを歓迎しています。 – Adinia

5

mapsforge libraryも非常に有望です。それらはGoogleMaps APIと互換性があり、インポートを交換するだけでよいと思われます。

0

Osmdroidは、この目的のために非常にうまく機能:

http://code.google.com/p/osmdroid/

我々は我々のアプリでそれを使用し、今までどんな欠点を持っていません。

0

線の下に追加:ファイルの依存関係:あなたのbuild.gradle(アプリモジュール)に

compile 'org.osmdroid:osmdroid-android:5.6.2' 

dependencies { 
    //Other required dependencies 
    compile 'org.osmdroid:osmdroid-android:5.6.2' 
} 

これには、プロジェクトに必要なすべてのOSMライブラリが含まれます。あなたのxmlファイル(マップ画面)で

すでに書かれたGoogleのマップコードとコードの下に置き換える:

<!--<fragment--> 
<!--android:layout_width="fill_parent"--> 
<!--android:layout_height="fill_parent"--> 
<!--android:id="@+id/mapview"--> 
<!--tools:context="cabse.ui.MapActivity"--> 
<!--android:name="com.google.android.gms.maps.SupportMapFragment"--> 
<!--android:layout_below="@+id/header" />--> 
<org.osmdroid.views.MapView 
    android:id="@+id/mapview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:clickable="true" 
    android:layout_below="@+id/header" 
    android:layout_above="@+id/layout_for_buttons"/>