loplat_plengi 1.0.7 copy "loplat_plengi: ^1.0.7" to clipboard
loplat_plengi: ^1.0.7 copied to clipboard

loplat plengi(Place Engine) SDK plugin project.

loplat_plengi #

loplat plengi(Place Engine) SDK plugin project.

Supported platforms #

  • Flutter Android(plengi v2.1.1.9.6)
  • Flutter iOS(MiniPlengi v1.4.2.2)
Android iOS
Support SDK 21+ 9.0+

Usage #

plugin을 사용하기 위해서 pubspec.yaml에 'loplat_plengi' 종속성을 추가해주세요. dependency in your pubspec.yaml file.

dependencies:
  flutter:
    sdk: flutter

  loplat_plengi: ^[plugin_version]

Examples #

아래는 plugin API를 사용하는 에시입니다.

Android #

자세한 내용은 로플랫 개발자 사이트에 설명되어 있습니다.

iOS 개발자는 iOS 가이드를 확인 부탁드립니다.

loplat SDK 종속성 추가

안드로이드 디렉토리 최상위 build.gradle에 아래의 코드를 추가하세요.

allprojects {
    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://maven.loplat.com/artifactory/plengi"}
        google()
    }
}

앱의 build.gradle에 아래의 코드를 추가하세요.

WARNING plugin이 정상적으로 동작하기 위해서 반드시 아래 지정된 버전만을 사용해야 합니다.

implementation 'com.loplat:placeengine:2.1.1.9.6'

Google Play Service libraries 적용

  1. 효율적인 위치 정보 획득을 위해서 build.gradle의 dependency에 아래와 같이 라이브러리 적용이 필요합니다.
implementation 'com.google.android.gms:play-services-location:21.0.1'
  1. loplat X를 사용하기 위해서 build.gradle 의 dependency에 아래와 같이 라이브러리 적용이 필요합니다.
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'

RETROFIT, GSON libraries 적용

위치 확인 요청시 서버와의 통신을 위해 Retrofit 및 GSON 라이브러리를 사용합니다. Retrofit 및 GSON 라이브러리 적용을 위해서 프로젝트의 build.gradle 에 아래와 같이 추가합니다.

implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.9'

Proguard를 사용한다면, 아래와 같이 proguard 설정을 추가해야 합니다.

-dontwarn okio.**
-dontwarn javax.annotation.**
# R8 compatibility for GSON, Serialization 관련한 룰보다 반드시 위에 먼저 선언
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
-keepclasseswithmembers class * {
@retrofit2.http.* <methods>;
}

-keep class com.loplat.placeengine.cloud.ResponseMessage** {*;}

-keep, allowobfuscation, allowshrinking interface retrofit2.Call
-keep, allowobfuscation, allowshrinking class retrofit2.Response

장소 인식 결과 리스너 등록

  1. Android native code에 PlengiListener를 구현해주세요.
import android.util.Log;
import com.google.gson.Gson;
import com.loplat.placeengine.PlengiListener;
import com.loplat.placeengine.PlengiResponse;

public class LoplatPlengiListener implements PlengiListener {
    private static final String TAG = LoplatPlengiListener.class.getSimpleName();
    @Override
    public void listen(PlengiResponse response) {
        try {
            String jsonStr = new Gson().toJson(response);
            Log.d(TAG, jsonStr);
        } catch (Exception ignored) {
            Log.e(TAG, ignored.toString());
        }
    }
}
  1. MainApplication.onCreate()에서 setListener()를 호출해서 구현한 PlengiListener를 등록해주세요.
import io.flutter.app.FlutterApplication;

import android.content.Context;
import com.loplat.placeengine.Plengi;

public class MainApplication extends FlutterApplication {
    @Override
    public void onCreate() {
        super.onCreate();

        Context applicationContext = getApplicationContext();
        Plengi plengi = Plengi.getInstance(applicationContext);
        plengi.setListener(new LoplatPlengiListener());
        plengi.setEchoCode("[your_echo_code]");
    }
}

캠페인 알림 수신 설정

loplat X를 통해 알림(FCM 아님)을 받기 위해서는 마케팅 알림 설정하기 전, plengi start 전에 아래와 같은 코드 작성이 필요 합니다.

  • 마케팅 알림 설정이 ON 인 경우
import 'package:loplat_plengi/loplat_plengi.dart';

// 앱이 만든 알림을 사용할 경우 (장소인식결과에서 advertisement 객체를 참고하여 알림 생성)
await LoplatPlengiPlugin.enableAdNetwork(true, false);
// SDK 가 만든 알림을 사용할 경우
await LoplatPlengiPlugin.enableAdNetwork(true, true);
  • 마케팅 알림 설정이 OFF 인 경우
import 'package:loplat_plengi/loplat_plengi.dart';

await LoplatPlengiPlugin.enableAdNetwork(false);

Start / Stop Plengi

start는 사용자의 위치약관동의 직후 호출해주세요. 앱 시작 혹은 로그인 할 때 마다 사용자의 위치약관동의 여부를 매번 확인해서 start를 호출해줘야만 합니다.

import 'package:loplat_plengi/loplat_plengi.dart';

await LoplatPlengiPlugin.start("[client_id]", "[client_secret]");

stop은 사용자의 위치약관동의에 대한 거부시에만 호출해주세요. 예외적인 케이스(사용자의 위치 권한 제거, 단말기 재부팅, 앱 비정상종료 등)에도 위치 모니터링이 가능합니다. 예외적인 케이스에 Stop을 호출하지 마세요.

await LoplatPlengiPlugin.stop();

iOS #

자세한 내용은 로플랫 개발자 사이트에 설명되어 있습니다.

android 개발자는 android 가이드를 확인 부탁드립니다.

3
likes
20
pub points
32%
popularity

Publisher

unverified uploader

loplat plengi(Place Engine) SDK plugin project.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on loplat_plengi