GamePot Docs
  • Welcome
  • Getting Started
    • Quickstart
  • Basics
    • GamePot 2.0
      • (中文)
        • Console
          • 使用前
          • 使用 GAMEPOT
        • Dasboard
          • 创建项目和仪表盘
          • 访问仪表盘
          • 转换为付费
          • 用户指标
          • 销售指标
          • 指标术语整理
          • 会员管理
          • 支付管理
          • 公告事项管理(Pro以上)
          • 维护和更新公告(Pro以上)
          • 发送消息
          • 优惠券管理(Pro以上)
          • 客户支持(Pro以上)
          • 游戏
          • 排行榜
          • 好友列表
          • 项目设置
          • 管理仪表盘用户
          • 仪表盘管理员功能
        • Unity SDK
          • Unity SDK_配置要求
          • Unity SDK_SDK安装及环境配置
          • Unity SDK_登录相关功能
          • Unity SDK_第三方账户关联
          • Unity SDK_支付功能
          • Unity SDK_SDK自主提供的登录UI
          • Unity SDK_优惠券功能
          • Unity SDK_推送功能
          • Unity SDK_显示公告事项图片的功能
          • Unity SDK_客户支持功能
          • Unity SDK_恶意使用支付取消的用户重新支付弹窗功能
          • Unity SDK_远程配置功能
          • Unity SDK_游戏日志传输功能
          • Unity SDK_确认AppStatus
          • Unity SDK_第三方SDK关联
          • Unity SDK_关联Firebase SDK时注意事项
          • Unity SDK_在Native环境下修改项目
        • Unreal SDK
          • 安装及环境配置
          • 登录相关功能
          • 第三方账户关联
          • 支付功能
          • 自主提供的登录UI
          • 优惠券功能
          • 推送功能
          • 显示公告事项图片的功能
          • 客户支持功能
          • 恶意使用支付取消的用户重新支付弹窗功能
          • 远程配置功能
          • 游戏日志传输功能
          • 第三方SDK关联
        • Android SDK
          • Android SDK_配置要求
          • Android SDK_安装SDK和配置环
          • Android SDK_登录相关功能
          • Android SDK_关联外部账户
          • Android SDK_支付功能
          • Android SDK_SDK自行提供的登录UI
          • Android SDK_优惠券功能
          • Android SDK_推送功能
          • Android SDK_公告事项图像显示功能
          • Android SDK_客户支持功能
          • Android SDK_维护及强制更新功能
          • Android SDK_远程配置功能
          • Android SDK_游戏日志传输功能
          • Android SDK_确认AppStatus
          • Android SDK_关联第三方SDK
        • iOS SDK
          • iOS SDK_配置要求
          • iOS SDK_安装及环境配置
          • iOS SDK_登录相关功能
          • iOS SDK_第三方账户关联
          • iOS SDK_支付功能
          • iOS SDK_自主提供的登录UI
          • iOS SDK_优惠券功能
          • iOS SDK_推送功能
          • iOS SDK_显示公告事项图片的功能
          • iOS SDK_客户支持功能
          • iOS SDK_维护及强制更新功能
          • iOS SDK_远程配置功能
          • iOS SDK_游戏日志传输功能
          • iOS SDK_确认AppStatus
          • iOS SDK_第三方SDK关联
        • Javascript SDK
          • JS SDK_安装及环境配置
          • JS SDK_重置
          • JS SDK_登录,退出
          • JS SDK_插件
        • Server API
          • 请求发放付费道具
          • Gamepot user ID verification(optional)
          • 外部支付
        • Open API
          • 查询用户
          • 查询用户停用
          • 设置用户停用
          • 查询每日访问者(DAU)
          • 查询新用户(NRU)
          • 查询同时访问者(CCU)
          • 查询支付
          • 查询取消支付
          • 查询支付销售统计
          • 查询角色
          • 查询一般优惠券的使用
          • 使用优惠券
          • 查询展示中的公告事项
          • 排名板
            • 排名板用户分数登录API
            • 导入排名板用户分数API
            • 使用特定搜索词获取分数API
            • 获取排名板信息和用户数的API
            • 用排名板查询用户分数的API
            • 删除登录排行板用户API
            • 排名板登录API
            • 排名板修改API
            • 排名板删除API
          • 好友管理
          • 提前预约参与
          • 提前预约验证码确认
          • 查询本人认证结果
        • Troubleshooting
          • 在64-bit环境下的构建过程中,尝试使用NAVER ID登录时发生崩溃(构建API 28以上的Android)
          • 上传Play Store APK时,会发出com.nhncorp.nelo2.android.util加密模式安全通知
          • 构建iOS时发生错误
          • Line i386 x86_64 IOS Archive上传问题
          • AdbrixRM i386 x86_64 iOS构建问题
          • 使用NAVER ID登录时出现的NaverThirdPartyLogin.framework i386 x86_64问题
          • Unity 2018.4.4以上、Unity 2019.2.0以上版本中的Android构建问题
          • (Unity)应用NAVER Lounge SDK(以NaverSDK Ver 1.1.1为例进行说明)
          • (Unity)应用GoogleMobileAds SDK(以GoogleMobileAds-v6.1.2为例进行说明)
          • (Unity)应用Appsflyer/Singular SDK(以appsflyer-v6.3.2为例进行说明)
          • (Unity)单独应用Firebase SDK时(以Firebase Unity 8.7.0为例进行说明)
          • 升级到android、targetsdkversion 31以上时,出现以下错误和应用无法安装的问题
          • 在Android OS 13设备上无法接收推送设置时
          • GAMEPOT SDK中收集的个人信息类型
          • (Unity) 使用Unity编辑选项中的minify时
        • FAQ
          • 无法登录!
          • 无法付款!
          • 未收到應用內項目列表
          • Adbrix Remaster
          • Naver Cafe
          • 服务推出
          • 推送
          • 应用签名
          • 用户ID迁移方法
          • 用户ID恢复
          • 仪表盘提前预约页面关联方法
          • 案例集
          • 版本 3.5.1 中的變更 - 由於安全問題,禁止使用此版本。
          • Ver Unity 2.1.1 To Ver Unity 2.1.2 Or New Version
          • android, targetsdkversion 升到31的时候
          • Gamepot v3.6.0 更新
      • NPUSH
        • FCM (Android)
        • APNs (iOS)
      • NPUSH (English)
        • FCM (Android)
        • APNs (iOS)
      • NPUSH (日本語)
        • FCM (Android)
        • APNs (iOS)
      • NPUSH (中文)
        • FCM (Android)
        • APNs (iOS)
    • GamePot 3.0
      • GAMEPOT 3.0 (KR)
        • GAMEPOT 사용
          • 실시간 통계
          • Apple App Store shared secret
          • Google Play Store API 인증
          • Unity SDK
          • Android SDK
          • iOS SDK
          • Javascript SDK
          • 스토어 환경 설정
            • Google Play Store 환경 설정
            • App Store Connect
            • ONE store
          • 로그인 인증 환경 설정
            • 구글 로그인
            • 애플 아이디 로그인
            • 페이스북 로그인
            • 스팀 로그인
          • 푸시
          • 고객센터
          • 사용자 통계
          • 동시 접속 사용자
          • 쿠폰
          • 플러그인
          • 게임팟 NPUSH 서비스 전환 및 푸시 서비스 변경 안내
          • 게임팟 스튜디오 ( 빌드 관리, 게임 런쳐 )
          • 로컬 푸시
          • 비속어 필터
      • GAMEPOT 3.0 (EN)
        • Using GAMEPOT
          • Real-Time Statistics
          • Apple App Store shared secret
          • Google Play Store API Authentication
          • Unity SDK
          • Android SDK
          • iOS SDK
          • Store Settings
            • Google Play Store Configuration
            • App Store Connect
            • ONE store
          • Login Authentication Settings
            • Google Login
            • Apple ID Login
            • Facebook Login
          • PUSH
          • Customer Support
          • User Statistics
          • Concurrent Users
          • Plugin
    • Interactive blocks
    • OpenAPI
    • Integrations
    • GamePot Console
      • 메인화면
      • 통합 대시보드
      • 대시보드
      • 분석
        • 사용자 분석
        • 매출 분석
      • 운영
        • 사용자
          • 목록
          • 일간 활성 사용자
          • 신규 등록 사용자
          • 동시 접속자
          • 이용정지
        • 구매
          • 목록
          • 앱 내 구매
          • 통계
          • 취소된 결제
          • 외부 결제
        • 점검 및 업데이트
          • 점검
          • 업데이트
        • 메시지
          • 푸시 알림
          • 문자 메시지
        • 쿠폰
          • 일반 쿠폰
          • 키워드 쿠폰
          • 쿠폰 사용량
        • 고객 지원
          • 대시보드
          • 고객 문의
          • 통계
          • 리뷰
          • 페이지
          • 설정
            • 일반
            • 규칙
            • 분류
            • 스타일링
            • 공지
            • FAQ
            • 정책 약관
            • 이메일 알림
        • 게임
          • 공지사항
          • 랭킹
          • 친구
          • 플레이어
          • 선물
          • 아이템
        • 게임 운영
          • 데이터 저장소
          • 원격 설정
          • 블랙리스트
      • 설정
        • 프로젝트 설정
        • 관리자
Powered by GitBook
On this page
  • Key Features
  • How to Use Push Notifications (Mobile)
  • Add Code to Set Up Push
  • Change Push Status
  • How to Test Push Notifications (Mobile)
  • Troubleshooting
  1. Basics
  2. GamePot 3.0
  3. GAMEPOT 3.0 (EN)
  4. Using GAMEPOT

PUSH

Push notifications allow developers to send reliable and efficient messages from servers or the cloud to mobile devices. By using push, you can send notification messages (messages that the system displays to the user) and data messages (key-value pairs of data that the app processes) to mobile apps and web apps. Push notifications support a variety of platforms, including iOS, Android, and web applications.

Starting from May 15, 2024, Firebase Cloud Messaging (FCM) will expire tokens on Android devices that have been inactive for more than 270 days. If your account is affected, the number of subscription cancellations may increase.

Key Features

  • Variety of Message Types: You can send various types of messages, including notification messages and data messages.

  • Mass Messaging: Push notifications allow you to send messages to millions of users simultaneously, enabling efficient messaging in large-scale applications.

  • Cross-Platform Support: Messages can be received on various platforms, including iOS, Android, and web applications.

  • Advanced Messaging Options: Offers advanced features like setting message priorities, message lifespan, topic-based subscriptions, and conditional message delivery.

How to Use Push Notifications (Mobile)

  1. Set Up Firebase Project

    • Create a project in the Firebase Console (console.firebase.google.com).

    • Add an application (Android or iOS) to the created project.

    • Download the necessary Firebase configuration files (google-services.json or GoogleService-Info.plist) and add them to the Gamepot Dashboard under settings.

  2. Add FCM SDK

    • For Android, add the necessary definitions in the build.gradle.kts files for both the app module and project module.

      // (Module : app) build.gradle.kts
      plugins {
      ...
         id("com.google.gms.google-services")
      }
      
      dependencies {
      ...
         implementation("com.google.firebase:firebase-messaging-ktx:23.2.1")
      }

      // (Module : project)의 build.gradle.kts
      plugins {
         ...
         id("com.google.gms.google-services") version "4.3.15" apply false
      }
    • iOS의 경우, CocoaPods을 사용하여 Firebase/Messaging pod를 설치합니다.

  3. Requesting Permission for Push Notifications (iOS)

    • For iOS apps, you must request permission from the user to allow push notifications. This can be done using UNUserNotificationCenter.

  4. Device Token Registration and Message Reception

    • When the app is installed and launched, the FCM SDK generates a unique token for the app instance. This token can be registered on the server to send messages to specific devices.

    • To receive messages, implement a listener in the application.

By using FCM, you can enhance user engagement, deliver critical information quickly, and build a customized notification system that supports a variety of messaging scenarios. FCM provides developers with a variety of tools and APIs to easily integrate and manage cloud messaging.

Add Code to Set Up Push

No additional actions are required to use push notifications.

Add the code below to AppDelegate.

import NBase

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
    // 푸시 사용여부 퍼미션 허가 요청
    registerForRemoteNotifications()
    return true
}
func registerForRemoteNotifications() {
    let center = UNUserNotificationCenter.current()
    center.requestAuthorization(options: [.alert, .sound, .badge]) { (granted, error) in
        if granted {
            DispatchQueue.main.async {
                UIApplication.shared.registerForRemoteNotifications()
            }
        } else {
            print("The push notification permission has been denied")
        }
    }
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
    // 토큰을 서버로 전송하여 저장하거나 사용합니다.
    NBase.setPushToken(token: token)
}

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
    // 푸시 알림 등록에 실패했습니다. 오류: \(error.localizedDescription)
    NBase.setPushToken(token: "")
}

Please check 'Use Notification' in Tools -> GamePotSDK -> Edit Settings.

Change Push Status

  • To change the push notification receipt settings, please call the code below.

NBaseSDK.NBase.setPushState(enable, night, ad, token, (pushState, error) => {
    if (error != null)
    {
        // failed.
        // Display the message using error.message.
    }
    else
    {
        // succeeded.
    }
});
val pushToken = NBase.getPushToken()
val pushState = com.nbase.sdk.model.PushState(
    enable = enable,
    night = night,
    ad = ad,
    token = pushToken
)
NBase.setPushState(pushState) { status, e ->
    if (error != null) {
        // failed.
        // Display the message using error.message.
    } else {
        // succeeded.
    }
};
String pushToken = _NBase.getPushToken();
com.nbase.sdk.model.PushState pushState = new com.nbase.sdk.model.PushState(
        Boolean.parseBoolean(enable),
        Boolean.parseBoolean(night),
        Boolean.parseBoolean(ad),
        pushToken
);
NBase nBase = NBase.INSTANCE;
nBase.setPushState(pushState, (status, e) -> {
    if (e != null) {
        // failed.
        // Display the message using e.getMessage.
    } else {
        // succeeded.
    }
    return null;
});
NBase.setPushState(enable: enable, ad: ad, night: night, token: NBase.getPushToken()) { result in
    switch result {
    case .success(let data):
        // succeeded.
    case .failure(let error):
        // failed.
    }
}
[NBaseBridge.shared setPushState:enable night:night ad:ad token:token :^(NSDictionary * _Nullable result, NSError * _Nullable error) {
    if (error) {
        // failed.
        // Display the message using error.localizedDescription.
    } else {
        // succeeded.
    }
}];
  • To check the push notification receipt settings, please call the code below.

NBaseSDK.NBase.getPushState((pushState, error) => {
    if (error != null)
    {
        // failed.
        // Display the message using error.message.
    }
    else
    {
        // succeeded.
    }
});
NBase.getPushState() { state, e ->
    if (error != null) {
        // failed.
        // Display the message using error.message.
    } else {
        // succeeded.
    }
};
NBase nBase = NBase.INSTANCE;
nBase.getPushState((state, e) -> {
    if (e != null) {
        // failed.
        // Display the message using e.getMessage.
    } else {
        // succeeded.
    }
    return null;
});
NBase.getPushState() { result in
    switch result {
    case .success(let data):
        // succeeded.
    case .failure(let error):
        // failed.
    }
}
[NBaseBridge.shared getPushState:^(NSDictionary * _Nullable result, NSError * _Nullable error) {
    if (error) {
        // failed.
        // Display the message using error.localizedDescription.
    } else {
        // succeeded.
    }
}];

How to Test Push Notifications (Mobile)

Push notifications can be tested in three ways:

  1. To verify via the dashboard: Go to Dashboard -> Member List -> Member Details (More Info) Click the Send Push button to send a push notification to the specific member.

  2. How to Test in the Firebase Console (AOS) In the Firebase Console, select your project, go to Messaging, and in the Campaigns section, click the New Campaign button to test message sending.

Copy and paste the token retrieved from the app, click the + button to input the token, and then press the Test button to complete the process. You can verify if the message is sent to the specified token.

After entering the Device Token and Payload, you can verify if the message is successfully sent to the specified token.

Troubleshooting

Q. java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.nbase.main. Make sure to call FirebaseApp.initializeApp(Context) first.

A. A. This error occurs when push notification settings are missing in the gradle file. Please check the following: build.gradle.kts at the top level of your project.

plugins {
   id("com.google.gms.google-services") version "4.4.1" apply false
}

Add it to the build.gradle.kts file within the app directory.

plugins {
    id("com.google.gms.google-services")
}

Q. org.gradle.api.GradleException: File google-services.json is missing. The Google Services Plugin cannot function without it.

A. This error occurs when the google-services.json file cannot be found. Please ensure that the file is correctly placed in the root folder of the module: app level. Example: ./project folder/app/google-services.json

PreviousFacebook LoginNextCustomer Support

Last updated 4 months ago

(iOS) How to Test in the CloudKit Console Go to the , navigate to Push Notifications, and create a new notification.

CloudKit Console