【问题标题】:blank map on my google maps v2 for android titanium module我的谷歌地图 v2 上的空白地图,适用于 android 钛模块
【发布时间】:2014-03-12 14:37:24
【问题描述】:

我正在使用适用于 Android 的 Titanium Goggle Maps v2(版本 2.1.3。),我正在使用 Titanium studio 3.1.3.201309132423。

示例文件夹中 app.js 文件中的示例代码适用于我。

但是,当我尝试创建自己的地图时,我收到了 Google 徽标、放大和缩小按钮以及将用户带到当前位置的按钮。然而,地图本身是空白的。起初这对我有用,但突然停止了。

我正在使用出现在模块的 appcelerator 文档中的 switch 语句,即

var rc = MapModule.isGooglePlayServicesAvailable();
    switch (rc) {
        case MapModule.SUCCESS:
            Ti.API.info('Google Play services is installed.');
            break;
        case MapModule.SERVICE_MISSING:
            alert('Google Play services is missing. Please install Google Play services from the Google Play store.');
            break;
        case MapModule.SERVICE_VERSION_UPDATE_REQUIRED:
            alert('Google Play services is out of date. Please update Google Play services.');
            break;
        case MapModule.SERVICE_DISABLED:
            alert('Google Play services is disabled. Please enable Google Play services.');
            break;
        case MapModule.SERVICE_INVALID:
            alert('Google Play services cannot be authenticated. Reinstall Google Play services.');
            break;
        default:
            alert('Unknown error.');
            break;
    }

我的日志报告了第一个安装 GOOGLE PLAY 服务的案例

我的 ti.App.xml 如下:

<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
    <id>com.girt.MyApp</id>
    <name>MyApp</name>
    <version>1.0</version>
    <publisher>roseanne</publisher>
    <url>http://www.apps.com</url>
    <description>not specified</description>
    <copyright>2014 by roseanne</copyright>
    <icon>appicon.png</icon>
    <persistent-wifi>false</persistent-wifi>
    <prerendered-icon>false</prerendered-icon>
    <statusbar-style>default</statusbar-style>
    <statusbar-hidden>true</statusbar-hidden>
    <fullscreen>false</fullscreen>
    <navbar-hidden>true</navbar-hidden>
    <analytics>true</analytics>
    <guid>78be39e9-acb5-469f-9fa2-3724280dee14</guid>
    <property name="ti.ui.defaultunit" type="string">system</property>
    <android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
                <!-- <uses-sdk android:targetSdkVersion="11"/> -->
            <!-- Allows the API to download data from Google Map servers -->
            <uses-permission android:name="android.permission.INTERNET"/>
            <!-- Allows the API to cache data -->
            <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>  
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

            <!-- Use GPS for device location -->
            <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
            <!-- Use Wi-Fi or mobile connection for device location -->
            <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
            <!-- Allows the API to access Google web-based services -->
            <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
            <!-- Specify OpenGL ES 2.0 as a requirement -->
            <uses-feature android:glEsVersion="0x00020000" android:required="true"/>
            <!-- Replace <com.domain.appid> with your application ID -->
            <uses-permission android:name="com.girt.Myapp.permission.MAPS_RECEIVE"/>
            <permission android:name="com.girt.Myapp.permission.MAPS_RECEIVE" android:protectionLevel="signature"/>
            <application>
                <!-- Replace "PASTE YOUR GOOGLE MAPS API KEY HERE" with the Google API key you obtained -->
                <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="xxxxxxxxxxxxxxx"/>
            </application>
        </manifest>
    </android>
    <mobileweb>
        <precache/>
        <splash>
            <enabled>true</enabled>
            <inline-css-images>true</inline-css-images>
        </splash>
        <theme>default</theme>
    </mobileweb>
    <modules>
        <module platform="android" version="1.1">com.gbaldera.titouchgallery</module> 
        <module platform="android" version="0.1">titutorial.ratingbar</module>
        <module platform="android" version="2.1.3">ti.map</module>
    </modules>
    <deployment-targets>
        <target device="iphone">false</target>
        <target device="ipad">false</target>
        <target device="android">true</target>
        <target device="blackberry">false</target>
        <target device="mobileweb">true</target>
        <target device="tizen">false</target>
    </deployment-targets>
    <sdk-version>3.1.1.GA</sdk-version>
</ti:app>

如果有人可以帮忙,我已经为此工作了两天,还没有找到解决方案。最令人沮丧的部分是它一直在工作,然后停止了。

【问题讨论】:

  • 我只在某些设备上遇到了同样的问题,例如:Samsung S4 但不是 Nexus 5。我尝试了以下更改以将背景设置为透明但没有成功。你在调试的时候还有什么其他的注意事项吗?
  • @dmasi 抱歉,这是我能发现的唯一问题。我会联系模块的开发人员。过去,iOS 模块开发人员对我非常有帮助和响应

标签: android google-maps titanium google-maps-android-api-2


【解决方案1】:

经过一整天的沮丧后,我发现当我按下返回按钮时,我几乎可以在一瞬间看到一张半透明的地图。我更改了 zIndex 并没有区别。然后我将窗口的背景颜色更改为“透明”,瞧

【讨论】:

    【解决方案2】:

    我也遇到了这个问题,这里的解决方案并不完全有效。这里还有一件事要尝试,我希望它对你有用。您实际上需要“启用” api 并创建它。我只是创建了它。

    为此,请转到谷歌控制台 点击“Google Maps Android API” 单击以启用它。

    然后从 appcelerator 中重新启动您的应用。最后,采取一些行动。

    祝你好运!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-06-04
      • 2011-06-14
      • 1970-01-01
      • 2014-03-01
      • 2020-06-06
      • 2016-04-09
      • 2014-01-15
      相关资源
      最近更新 更多