我的谷歌地图v2上的空白地图为Android钛模块

时间:2014-03-12 14:37:25

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

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

示例文件夹中的app.js文件中的示例代码正在为我工​​作。

但是,当我尝试创建自己的地图时,我会收到Google徽标,放大和缩小按钮以及将用户带到当前位置的按钮。但地图本身就是BLANK。这起初是为我工作而且突然停了下来。

我正在使用出现在模块的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>

如果有人可以请求帮助,我已经为此工作了两天而没有找到解决方案。关于它的最令人沮丧的部分是,它正在工作,然后停止。

2 个答案:

答案 0 :(得分:1)

经过一整天的挫折之后,我发现当我按下后退按钮时,我几乎可以看到半透明的地图。我更改了zIndex并没有区别。然后我将窗口的backgroundColor更改为'transparent'并瞧

答案 1 :(得分:0)

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

要执行此操作,请转到Google控制台 点击“Google Maps Android API” 单击以启用它。

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

祝你好运!