0

有谁知道如何获取我在 IndoorAtlas 网站上上传的 floorPlan 图像?我已经在 IndoorAtlas 网站上完成了所有步骤,但是当我运行我的应用程序时,它会显示白页,我希望看到地图,并且我使用 Android 步骤完成了所有设置定位 SDK,并使用https中的 Android 步骤获取平面图图像: //indooratlas.freshdesk.com/support/solutions/articles/36000051242-fetching-floor-plan-images-with-android

请任何对我有帮助的东西这是我的代码

构建 Gradle


plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.example.test_gp12"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
    testImplementation 'junit:junit:4.+'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.indooratlas.android:indooratlas-android-sdk:3.4.9@aar'
    implementation'com.google.android.gms:play-services-maps:18.0.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
    implementation 'androidx.constraintlayout:constraintlayout-compose:1.0.0-rc01'

}
repositories{
    maven {
        url "https://dl.cloudsmith.io/public/indooratlas/mvn-public/maven/"
    }
    google()
} 

主要活动

import android.os.Bundle;
import android.widget.ImageView;

import androidx.appcompat.app.AppCompatActivity;

import com.indooratlas.android.sdk.IALocationManager;
import com.indooratlas.android.sdk.IARegion;
import com.indooratlas.android.sdk.resources.IAFloorPlan;
import com.squareup.picasso.Picasso;

public class MainActivity extends AppCompatActivity {
    IALocationManager mIALocationManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mIALocationManager = IALocationManager.create(this);
    }
    private IARegion.Listener mRegionListener = new IARegion.Listener() {
        @Override
        public void onEnterRegion(IARegion region) {
            if (region.getType() == IARegion.TYPE_FLOOR_PLAN) {
                handleFloorPlanChange(region.getFloorPlan());
            }
        }

        @Override
        public void onExitRegion(IARegion region) {
            // leaving a previously entered region
        }
    };

    private void handleFloorPlanChange(IAFloorPlan newFloorPlan) {
        ImageView mFloorPlanImage = findViewById(R.id.map1);
        Picasso.with(this)
                .load(newFloorPlan.getUrl())
                .into(mFloorPlanImage);
    }
} 


清单

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.test_gp12">

    <uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />
    <uses-feature android:name="android.hardware.sensor.compass"  android:required="true" />
    <uses-feature android:name="android.hardware.sensor.gyroscope"  android:required="true" />
    <uses-feature android:name="android.hardware.wifi" android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.Test_gp12">

        <meta-data
            android:name="com.indooratlas.android.sdk.API_KEY"
            android:value=""/>
        <meta-data
            android:name="com.indooratlas.android.sdk.API_SECRET"
            android:value=""/>
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value=""/>

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>```
4

0 回答 0