Skip to content

feat: add ndk crashes API #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## [15.0.2](https://github.com/Instabug/Instabug-Flutter/compare/v14.3.0...15.0.2) (Jul 7, 2025)
## [Unreleased](https://github.com/Instabug/Instabug-Flutter/compare/v15.0.2...dev)

### Added

- Add new APIs to support NDK Crashes. ([#607](https://github.com/Instabug/Instabug-Flutter/pull/607))

## [15.0.2](https://github.com/Instabug/Instabug-Flutter/compare/v14.3.0...15.0.2) (Jul 7, 2025)

### Added

Expand All @@ -20,7 +26,6 @@

- Bump Instabug Android SDK to v14.3.1 ([#577](https://github.com/Instabug/Instabug-Flutter/pull/577)). [See release notes](https://github.com/Instabug/Instabug-Android/releases/tag/v14.3.1).


## [14.3.0](https://github.com/Instabug/Instabug-Flutter/compare/v14.1.0...14.3.0) (April 21, 2025)

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,12 @@ public void sendNonFatalError(@NonNull String jsonCrash, @Nullable Map<String, S
}
}

@Override
public void setNDKEnabled(@NonNull Boolean isEnabled) {
if (isEnabled) {
CrashReporting.setNDKCrashesState(Feature.State.ENABLED);
} else {
CrashReporting.setNDKCrashesState(Feature.State.DISABLED);
}
}
}
5 changes: 5 additions & 0 deletions ios/Classes/Modules/CrashReportingApi.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,9 @@ - (void)sendNonFatalErrorJsonCrash:(nonnull NSString *)jsonCrash userAttributes:
userAttributes:userAttributes];

}

- (void)setNDKEnabledIsEnabled:(nonnull NSNumber *)isEnabled error:(FlutterError * _Nullable __autoreleasing * _Nonnull)error {
// This is auto-generated with pigeon, there is no NDK crashes for iOS.
}

@end
11 changes: 11 additions & 0 deletions lib/src/modules/crash_reporting.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:instabug_flutter/src/generated/crash_reporting.api.g.dart';
Expand Down Expand Up @@ -116,4 +117,14 @@ class CrashReporting {
);
return crashData;
}

/// Enables and disables NDK crash reporting.
/// [boolean] isEnabled
///
/// Requires the [Instabug NDK package](https://pub.dev/packages/instabug_flutter_ndk) to be added to the project for this to work.
static Future<void> setNDKEnabled(bool isEnabled) async {
if (Platform.isAndroid) {
return _host.setNDKEnabled(isEnabled);
}
}
}
2 changes: 2 additions & 0 deletions pigeons/crash_reporting.api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ abstract class CrashReportingHostApi {
String? fingerprint,
String nonFatalExceptionLevel,
);

void setNDKEnabled(bool isEnabled);
}