위치 모니터 확장 기능을 사용하려면 다음 작업을 완료하십시오.
위치 모니터 확장 기능에 대한 구성 작업이 없습니다.
구성
Android 또는 iOS 애플리케이션에 위치 모니터 확장 기능을 추가하는 방법은 아래에 나와 있습니다.
Places Monitor 익스텐션에 대한 추가 플랫폼 지원은 다음과 같습니다.Cordova 위치 모니터
Android에서 다음 단계를 완료하십시오.
앱의 등급 파일을 사용하여 위치 모니터 확장 기능과 위치 확장을 프로젝트에 추가합니다.
또한 최신 Google 위치 서비스를 일반 파일에 포함시킬 수 있습니다.
implementation 'com.adobe.marketing.mobile:places:1.+'
implementation 'com.adobe.marketing.mobile:places-monitor:1.+'
implementation 'com.adobe.marketing.mobile:sdk-core:1.+'
implementation 'com.google.android.gms:play-services-location:16.0.0'
애플리케이션의 기본 활동에서 위치 모니터 확장 기능을 가져옵니다.
import com.adobe.marketing.mobile.PlacesMonitor;
iOS에서 다음 단계를 완료하십시오.
Podfile
by adding pod 'ACPPlacesMonitor'
.#import "ACPCore.h"
#import "ACPPlaces.h"
#import "ACPPlacesMonitor.h"
import ACPCore
import ACPPlaces
import ACPPlacesMonitor
Android 또는 iOS에서 장소 모니터를 등록하고 시작해야 합니다.
Android에서 다음 단계를 완료하십시오.
앱의 OnCreate
메서드에서 위치 모니터 확장을 등록합니다.
public class MobileApp extends Application {
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
MobileCore.ConfigureWithAppId("yourAppId");
try {
PlacesMonitor.registerExtension(); //Register PlacesMonitor with Mobile Core
Places.registerExtension(); //Register Places with Mobile Core
MobileCore.start(null);
PlacesMonitor.start();//Start monitoring the geo-fences
} catch (Exception e) {
//Log the exception
}
}
}
위치 모니터링은 위치 확장명에 따라 다릅니다. 위치 모니터 확장명을 수동으로 설치하는 경우, 프로젝트에 places.aar
라이브러리를 추가해야 합니다.
iOS 앱에서application:didFinishLaunchingWithOptions
Mobile Core PlacesMonitor
에 등록 및 위치:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
[ACPCore configureWithAppId:@"yourAppId"];
[ACPPlaces registerExtension];
[ACPPlacesMonitor registerExtension];
[ACPCore start:^{
// do other initialization required for the SDK
[ACPPlacesMonitor start];
}];
return YES;
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ACPCore.configure(withAppId: "yourAppId")
ACPPlaces.registerExtension()
ACPPlacesMonitor.registerExtension()
ACPCore.start({
// do other initialization required for the SDK
ACPPlacesMonitor.start()
})
// Override point for customization after application launch.
return true
}
위치 모니터링은 위치 확장명에 따라 다릅니다. When manually installing the Places Monitor extension, ensure that you also add the libACPPlaces_iOS.a
library to your project.
Java
모든 버전의 Android에서 앱에 위치 권한이 필요하다고 선언하려면 앱 매니페스트에 <uses-permission>
요소를 최상위 <manifest>
요소의 자식으로 추가하십시오. API 레벨 29 이상을 대상으로 하는 Android 응용 프로그램의 경우 앱이 백그라운드에서 위치에 액세스할 수 있도록 허용하려면 ACCESS_BACKGROUND_LOCATION 권한을 포함합니다.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.adobe.placesapp">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
// Only for Android apps targeting API level 29 and above
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<application>
...
</application>
</manifest>
iOS는 일시 중단되거나 더 이상 실행되지 않는 앱에 위치 이벤트 전달을 지원합니다. 위치 모니터 확장 프로그램의 백그라운드에서 위치 업데이트를 받으려면 앱에서 위치 업데이트 기능을 구성하십시오 Xcode.background-location-updates
.
다음 키가 앱의 Info.plist
파일에 포함되어야 합니다.
NSLocationWhenInUseUsageDescription
- 전경 상태에서 앱을 실행할 때 앱이 사용자의 위치 정보에 대한 액세스를 요청하는 이유를 설명해야 합니다.NSLocationAlwaysAndWhenInUseUsageDescription
- 텍스트는 앱이 사용자의 위치 정보에 대한 액세스를 항상 요청하는 이유를 설명합니다.앱이 iOS 10 및 이전 버전을 지원하는 경우 NSLocationAlwaysUsageDescription
키도 필요합니다.