Code Monkey home page Code Monkey logo

flutter-sdk's Introduction

PubDev

Mindbox SDK for Flutter

The Mindbox SDK allows you to integrate mobile push-notifications, in-app messages and client events into your Flutter projects.

Getting Started

These instructions will help you integrate the Mindbox SDK into your Flutter app.

Installation

To integrate Mindbox SDK into your Flutter app, follow the installation process detailed here. Here is an overview:

Add Mindbox's dependency to your pubspec.yaml file:

   dependencies:
flutter:
sdk: flutter
mindbox: ^2.8.4

Initialization

Initialize the Mindbox SDK in your Activity or Application class. Check documentation here for more details.

Operations

Learn how to send events to Mindbox. Create a new Operation class object and set the respective parameters. Check the documentation for more details.

Push Notifications

Mindbox SDK helps handle push notifications. Configuration and usage instructions can be found in the SDK documentation here, here and here.

Troubleshooting

Refer to the Example of integration(IOS) or Example of integration(Android) in case of any issues.

Further Help

Reach out to us for further help and we'll be glad to assist.

License

The library is available as open source under the terms of the License.

For a better understanding of this content, please familiarize yourself with the Mindbox Flutter SDK documentation.

flutter-sdk's People

Contributors

enotniy avatar itmindbox avatar kniksees avatar robalim avatar sergeysozinov avatar ssozinov avatar umbrellait-nikolay-silantyev avatar umbrellait-timur-khismatullin avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

flutter-sdk's Issues

Mindbox.instance.onPushClickReceived перестает работать после обновления версии

Здравствуйте! Прошу помочь, может я что-то упускаю.
Обновил версию пакета с 2.1.4 до 2.8.5 и перестает работать коллбэк onPushClickReceived
build:gradle:7.4.2
из MainActivity убран deprecated метод processMindboxIntent
для Firebase прописан класс, но он был и раньше

package com.creonit.novex
import cloud.mindbox.mobile_sdk.Mindbox
import com.google.firebase.messaging.*
import cloud.mindbox.mindbox_firebase.MindboxFirebase

class MindboxFirebaseMessagingService: FirebaseMessagingService() {
    override fun onNewToken(token: String) {
        // Передача токена в Mindbox SDK
        Mindbox.updatePushToken(applicationContext, token, MindboxFirebase)
        super.onNewToken(token)
    }

    override fun onMessageReceived(remoteMessage: RemoteMessage) {
        val channelId = "android_channel_id"      // "my_android_app_channel"
        val channelName = "android_channel"         // "Рекламные рассылки"
        val channelDescription = "android_description"  // "Рассылки, которые содержат рекламу"
        val pushSmallIcon = R.drawable.ic_push

        // Метод возвращает boolen, чтобы можно было сделать фолбек для обработки пуш уведомлений
        val messageWasHandled = Mindbox.handleRemoteMessage(
                context = applicationContext,
                message = remoteMessage,
                activities = mapOf(),
                channelId = channelId,
                channelName = channelName,
                pushSmallIcon = pushSmallIcon,
                defaultActivity = MainActivity::class.java,
                channelDescription = channelDescription
        )

        if (!messageWasHandled) {
            // Если пуш был не от Mindbox или в нем некорректные данные, то можно написать фолбе для его обработки
        }
    }
}

и для хуавей аналогичный тоже есть.
в MainApplication есть строка Mindbox.initPushServices(applicationContext, listOf(MindboxFirebase))

в build.gradle такие версии

dependencies {
    implementation platform('com.google.firebase:firebase-bom:29.3.1')
    implementation 'com.google.firebase:firebase-analytics-ktx'
    implementation 'com.google.firebase:firebase-messaging-ktx'
    implementation 'com.google.firebase:firebase-crashlytics'
    implementation 'com.yandex.android:maps.mobile:4.5.1-lite'
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'cloud.mindbox:mobile-sdk:2.8.5'
    gplayImplementation 'cloud.mindbox:mindbox-firebase:2.8.5'
    huaweiImplementation 'cloud.mindbox:mindbox-huawei:2.8.5'
    huaweiImplementation 'com.huawei.hms:push:6.7.0.300'
}

пуш доходит, но тело функции onPushClickReceived не отрабатывает, а на версии 2.1.4 такой проблемы нет. Версия флаттера у проекта 3.16.4.
Если вы видите, что какие-то версии указаны неверно, прошу сообщить и возможно мне этого будет достаточно.

Ios rich-push functionality

Please guide me, if there is a way to configure reach push on ios using this package without forking and adding functionality by yourself?

App build always failed

FAILURE: Build failed with an exception.

What went wrong:
Execution failed for task ':app:checkProdDebugAarMetadata'.
Could not resolve all files for configuration ':app:prodDebugRuntimeClasspath'.
Could not find com.huawei.hms:push:6.5.0.300.
Searched in the following locations:

Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Get more help at https://help.gradle.org/
BUILD FAILED in 19s

Flutter doctor output:
[✓] Flutter (Channel stable, 3.7.12, on macOS 14.4 23E214 darwin-arm64, locale en-MD)
• Flutter version 3.7.12 on channel stable at /Users/dronn1k/flutter/sdk/3.7.12
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4d9e56e694 (11 months ago), 2023-04-17 21:47:46 -0400
• Engine revision 1a65d409c7
• Dart version 2.19.6
• DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/dronn1k/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/java
• Java version Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15E204a
• CocoaPods version 1.15.2

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Android Studio (version 2023.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.

[✓] VS Code (version 1.87.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.84.0

[✓] Connected device (2 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 12 (API 31) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.4 23E214 darwin-arm64

[✓] HTTP Host Availability
• All required HTTP hosts are available

! Doctor found issues in 2 categories.

Kotlin Gradle plugin version

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':mindbox_android' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

It reproduces after updating Android Gradle plugin to version 7.3.0

Method 'updateNotificationPermissionStatus' isn't work

In file
lib/src/types/mindbox_mock_method_call_handler.dart
method updateNotificationPermissionStatus

The problem is the flag 'granted' do not passed into native part as argument

image

How reproduce

  1. IOS Appdelegate extends FlutterAppDelegate. According with instructions
    https://developers.mindbox.ru/docs/ios-send-push-notifications-appdelegate
  2. I need to ask permission a little bit later, than on start of my app, so I commented this part of code
    image
  3. Next I use method 'updateNotificationPermissionStatus' like in instructions (ask permission and send)
    https://developers.mindbox.ru/docs/методы-flutter-sdk#updatenotificationpermissionstatus-since-283
  4. As result, user's card do not have updated status (permission) and push cannot be sent.

Locally I fixed this issue by passing argument and all works fine

Обработка событий нажатия на пуш

Здравствуйте!
Мы интегрируем в наше приложение данное SDK.
Все выполнили по инструкции указанной здесь https://developers.mindbox.ru/docs/flutter-sdk.
Столкнулись с проблемой.
При открытом приложении функция

Mindbox.instance.onPushClickReceived((link, payload) { 
    // тут делаем обработку 
});

отрабатывает нажатия на пуш как нужно, только при первом запуске и если свернешь приложение и опять нажмешь
на пуш то onPushClickReceived перестанет работать видать поток переключится на background.
Если данную функцию поместить в FirebaseMessaging.onBackgroundMessage то клик на уведомление будет
отработан но в другом потоке и поэтому его нужно будет как-то "ловить".
Как сделать что бы можно было обработать клик на сообщение когда приложение закрыто или свернуто?
Пуши с firebase нормально отрабатываются в FirebaseMessaging.onMessageOpenedApp при открытии приложения,
но пуши mindbox в FirebaseMessaging.onMessageOpenedApp не "ловятся"
Что делать уже не знаю. Помогите пожалуйста. Хотя бы пример рабочего кода увидеть как сделана обработка
onBackgroundMessage при закрытом приложении и при просто свернутом и что бы onPushClickReceived
продолжала работать всегда.
Спасибо за ранее за помощь!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.