I am trying to add a custom capacitor plugin to my android app. Works for iOS, currently I am integrating it into android.
I am no Java developer, my Java knowledge is fairly old. The build step of the app that builds the plugin alongside throws
request.addOnCompleteListener(task -> {
^
(use -source 8 or higher to enable lambda expressions)
- Where can I amp up my Java version to 8 in my ionic project to build with lambdas?
- How could I make this compatible with
-source 7
?
Activity activity = this.cordova.getActivity();
ReviewManager manager = ReviewManagerFactory.create(activity);
Task<ReviewInfo> request = manager.requestReviewFlow();
request.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
ReviewInfo reviewInfo = task.getResult();
Task<Void> flow = manager.launchReviewFlow(activity, reviewInfo);
flow.addOnCompleteListener(launchTask -> {
if (task.isSuccessful()) {
callbackContext.success();
} else {
Exception error = task.getException();
callbackContext.error("Failed to launch review - " error.getMessage());
}
});
} else {
Exception error = task.getException();
callbackContext.error("Failed to launch review flow - " error.getMessage());
}
});
The code is based on https://developer.android.com/guide/playcore/in-app-review/kotlin-java#java
CodePudding user response:
You need to set the Java version for the project.
It's in build.gradle