Skip to content

Conversation

fadi-george
Copy link
Contributor

@fadi-george fadi-george commented Sep 26, 2025

Description

One Line Summary

  • Had trouble running the existing flutter example; things like running it in the newer android studio. Updates flutter example to run on recent ios and android emulators
Screenshot 2025-09-26 at 3 01 23 PM Screenshot 2025-09-26 at 2 58 50 PM

Details

  • use gradle 8.6 for gradle properties
  • update formatting for onesignal java code and os flutter user c code
  • update readme example to address issues that may be encountered

Motivation

  • This is pr to add custom events support for the flutter sdk.

Scope

  • We want allow this beta feature to be used in more platforms like flutter, react-native, etc.

Manual testing

Run the example via flutter run and clicked the track event button to initiate that action.

  • tested with iPhone 16 (iOS 18) emulator
  • tested on Android (15) emulator

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

Copy link
Contributor

@nan-li nan-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the PR description? Some sections about custom events are not applicable to this PR.

Why was this needed? Was there a build issue or just upgrading in general? Is gradle and formatting the only changes? Did you use a new flutter version?

@fadi-george
Copy link
Contributor Author

Can you update the PR description? Some sections about custom events are not applicable to this PR.

Why was this needed? Was there a build issue or just upgrading in general? Is gradle and formatting the only changes? Did you use a new flutter version?

Had trouble running the old flutter example. I didn't any flutter version just gradle changes (7.3 -> 8.7).

pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("../local.properties").withInputStream { properties.load(it) }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't build this, my local.properties file is in the same directory as this file at example/android/local.properties. I had to change this to file("local.properties")....

Copy link
Contributor

@nan-li nan-li Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm The local.properties file goes in the project's root level, in the same folder as the gradlew, gradlew.bat, settings.gradle and other files, so unsure how this settings.gradle file defined it as one level up.

Copy link
Contributor Author

@fadi-george fadi-george Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ive updated the android folder with latest flutter template.

@fadi-george fadi-george force-pushed the fadi/fix-example branch 6 times, most recently from 632cd68 to 7136572 Compare October 1, 2025 23:24
The error can look like this on older versions:

Your project is configured with Android NDK 26.3.11579264, but the following plugin(s) depend on a different Android NDK version:
- onesignal_flutter requires Android NDK 27.0.12077973
Fix this issue by using the highest Android NDK version (they are backward compatible).
Add the following to /Users/nanli/Documents/GitHub/OneSignal-Flutter-SDK/example/android/app/build.gradle.kts:

    android {
        ndkVersion = "27.0.12077973"
        ...
    }
@fadi-george fadi-george merged commit f9aa0a2 into main Oct 2, 2025
2 checks passed
@fadi-george fadi-george deleted the fadi/fix-example branch October 2, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants