我在Android应用中使用谷歌地图,我在一些旧设备上看到以下消息:
我理解此消息的性质,更新将解决此问题。
但是我想避免用户一起看到这一切,只想在所有设备上加载地图。
这是我的依赖关系的样子:
请注意我添加了我需要的Google Play服务的各个部分,而不是完整的库,因为我开始从Android Studio收到关于太多代码行的错误 - 这就是我刚才所做的解决方法看似很多图书馆。
清单:
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.android.vending.BILLING" />
<!-- Creating Permission to receive Google Maps -->
<permission android:name="com.xyzapp.it.supportmapfragment.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
<!-- Permission to receive Google Maps -->
<uses-permission android:name="com.xyzapp.it.supportmapfragment.permission.MAPS_RECEIVE"/>
<!-- Permission to read Google Services -->
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--Maps API needs OpenGL ES 2.0. -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<supports-screens
android:anyDensity="true"
android:resizeable="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<application
android:name=".xyzappitApp"
android:hardwareAccelerated="true"
android:icon="@drawable/app_icon"
android:label="@string/app_name"
android:theme="@style/AppBaseTheme" android:largeHeap="true" >
<activity android:name=".SplashActivity" android:screenOrientation="portrait" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".TabHostActivity" android:configChanges="keyboardHidden|orientation|screenSize" android:icon="@drawable/app_icon" android:exported="true" />
<activity android:name=".StatusActivity" android:screenOrientation="portrait" />
<activity android:name=".StatusDetailsActivity" android:screenOrientation="portrait" />
<activity android:name=".MyAlertsActivity" android:screenOrientation="portrait" />
<activity android:name=".AlertLinesActivity" android:screenOrientation="portrait" />
<activity android:name=".AlertDetailsActivity" android:screenOrientation="portrait" />
<activity android:name=".PreferencesActivity" android:screenOrientation="portrait" android:theme="@style/ActionBarStyle" />
<activity android:name=".RouteListActivity" android:screenOrientation="portrait" />
<activity android:name=".StopListActivity" android:screenOrientation="portrait" />
<activity android:name=".StopTimesActivity" android:screenOrientation="portrait" />
<activity android:name=".UpgradeActivity" android:screenOrientation="portrait" />
<activity android:name=".TransfersActivity" android:screenOrientation="portrait" />
<activity android:name=".TransfersDetailsActivity" android:theme="@style/MyDialog" android:screenOrientation="portrait" />
<activity android:name=".ShareActivity" android:theme="@style/MyDialog" android:screenOrientation="portrait" />
<activity android:name=".ShareDetailsActivity" android:theme="@style/MyDialog" android:screenOrientation="portrait" />
<activity android:name=".MapActivity" android:configChanges="orientation|keyboardHidden" />
<activity
android:name="com.mopub.mobileads.MoPubActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name="com.mopub.mobileads.MraidActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name="com.mopub.common.MoPubBrowser"
android:configChanges="keyboardHidden|orientation|screenSize" />
<activity
android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
android:configChanges="keyboardHidden|orientation|screenSize" />
<service android:name=".Service.NotificationService" />
<receiver android:name="com.xyzapp.it.Receiver.MyAlarmReceiver" />
<receiver android:name="com.xyzapp.it.Receiver.ConnectionChangedReceiver" android:exported="false">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<receiver android:name="com.xyzapp.it.Receiver.BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<uses-library android:name="com.google.android.maps" />
<meta-data android:name="com.crashlytics.ApiKey" android:value="123456" />
<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="123456" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<meta-data android:name="com.google.android.gms.analytics.globalConfigResource" android:resource="@xml/global_tracker" />
</application>
理想情况下,我想知道如何加载地图,而不是强制用户更新为我的minSDK = 10且该应用程序支持Android 2.3设备及更高版本。
即使这意味着定位较低版本的Google Play服务以支持SDK 10+,我也可以使用该解决方案。
谢谢!
答案 0 :(得分:1)
但是我想避免用户一起看到这一切,只想在所有设备上加载地图。
然后不要使用Maps V2。相反,请使用其他一些映射解决方案(例如,Open Street Map)。
否则,没有&#34;魔法&#34;将在所有设备上避免此对话框的依赖项。虽然欢迎您使用该play-services-maps
依赖项的某些旧版本,但无法保证~15亿台设备都支持该特定版本的Play服务引擎而无需任何更新。