How to receive notification with one signal when app is in background or closed - flutter

I can only receive push notif when app is in foreground, followed instructions here and created a .java file in com.package.name now I have 2 files there MainActivity.java And NotificationServiceExtension.java
One signal version 3.4.2.
Also posted this on github
Added this on my manifest
<meta-data android:name="com.onesignal.NotificationServiceExtension"
android:value="com.bonfire.cdis.NotificationServiceExtension" />
Here is the error
Launching lib\main.dart on sdk gphone x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:24: error: cannot find symbol
builder.setColor(new BigInteger("FF00FF00", 16).intValue());
^
symbol: class BigInteger
location: class NotificationServiceExtension
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:26: error: cannot find symbol
Spannable spannableTitle = new SpannableString(notification.getTitle());
^
symbol: class Spannable
location: class NotificationServiceExtension
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:26: error: cannot find symbol
Spannable spannableTitle = new SpannableString(notification.getTitle());
^
symbol: class SpannableString
location: class NotificationServiceExtension
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:27: error: cannot find symbol
spannableTitle.setSpan(new ForegroundColorSpan(Color.RED),0,notification.getTitle().length(),0);
^
symbol: class ForegroundColorSpan
location: class NotificationServiceExtension
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:27: error: cannot find symbol
spannableTitle.setSpan(new ForegroundColorSpan(Color.RED),0,notification.getTitle().length(),0);
^
symbol: variable Color
location: class NotificationServiceExtension
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:30: error: cannot find symbol
Spannable spannableBody = new SpannableString(notification.getBody());
^
symbol: class Spannable
location: class NotificationServiceExtension
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:30: error: cannot find symbol
Spannable spannableBody = new SpannableString(notification.getBody());
^
symbol: class SpannableString
location: class NotificationServiceExtension
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:31: error: cannot find symbol
spannableBody.setSpan(new ForegroundColorSpan(Color.BLUE),0,notification.getBody().length(),0);
^
symbol: class ForegroundColorSpan
location: class NotificationServiceExtension
D:\caps\cdis\android\app\src\main\java\com\bonfire\cdis\NotificationServiceExtension.java:31: error: cannot find symbol
spannableBody.setSpan(new ForegroundColorSpan(Color.BLUE),0,notification.getBody().length(),0);
^
symbol: variable Color
location: class NotificationServiceExtension
9 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 7s
Exception: Gradle task assembleDebug failed with exit code 1

Related

flutter_local_notifications issue I'm facing when I run my partner app

flutter_local_notifications issue I'm facing, when I'm going to run my partner app.
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_local_notifications-9.9.1\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java:1554: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
^
symbol: variable TIRAMISU
location: class VERSION_CODES
C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\flutter_local_notifications-9.9.1\android\src\main\java\com\dexterous\flutterlocalnotifications\FlutterLocalNotificationsPlugin.java:1555: error: cannot find symbol
String permission = Manifest.permission.POST_NOTIFICATIONS;
^
symbol: variable POST_NOTIFICATIONS
location: class permission
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':flutter_local_notifications:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 3m 20s
Exception: Gradle task assembleDebug failed with exit code 1

Error: The getter 'hellawait' isn't defined for the class 'IOClient'

I created and run a location and weather based app. But when I closed the VS Code and try to reinstall the app, the following error occurred!.
How to remove the error!.
Launching lib\main.dart on Infinix X655C in debug mode...
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart:35:34: Error: Expected ')' before this.
var ioRequest = (hellawait _inner!.openUrl(request.method, request.url))
^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart:35:24: Error: The getter 'hellawait' isn't defined for the class 'IOClient'.
- 'IOClient' is from 'package:http/src/io_client.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/io_client.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'hellawait'.
var ioRequest = (hellawait _inner!.openUrl(request.method, request.url))
^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* 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 50s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
I know its a bit ago, but
flutter pub cache repair
helped me

flutter permission_handler Build fail

I am trying to add the package permission_handler to my flutter project but I cannot run the app. I get a build error. This is the error I get
C:\Users\Hp\dev\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionManager.java:321: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
^
symbol: variable S
location: class VERSION_CODES
C:\Users\Hp\dev\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:72: error: cannot find symbol
case Manifest.permission.BLUETOOTH_SCAN:
^
symbol: variable BLUETOOTH_SCAN
location: class permission
C:\Users\Hp\dev\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:74: error: cannot find symbol
case Manifest.permission.BLUETOOTH_ADVERTISE:
^
symbol: variable BLUETOOTH_ADVERTISE
location: class permission
C:\Users\Hp\dev\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:76: error: cannot find symbol
case Manifest.permission.BLUETOOTH_CONNECT:
^
symbol: variable BLUETOOTH_CONNECT
location: class permission
C:\Users\Hp\dev\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:259: error: cannot
find symbol
String result = determineBluetoothPermission(context, Manifest.permission.BLUETOOTH_SCAN);
^
symbol: variable BLUETOOTH_SCAN
location: class permission
C:\Users\Hp\dev\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:270: error: cannot
find symbol
String result = determineBluetoothPermission(context, Manifest.permission.BLUETOOTH_ADVERTISE);
^
symbol: variable BLUETOOTH_ADVERTISE
location: class permission
C:\Users\Hp\dev\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:281: error: cannot
find symbol
String result = determineBluetoothPermission(context, Manifest.permission.BLUETOOTH_CONNECT);
^
symbol: variable BLUETOOTH_CONNECT
location: class permission
C:\Users\Hp\dev\flutter\.pub-cache\hosted\pub.dartlang.org\permission_handler-8.2.5\android\src\main\java\com\baseflow\permissionhandler\PermissionUtils.java:370: error: cannot
find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && hasPermissionInManifest(context, null, permission )) {
^
symbol: variable S
location: class VERSION_CODES
8 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':permission_handler:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 2m 48s
I have reverted to an earlier version but I would like to know what is the cause of this error. My compile version is 30
as said in plugin github repository
These new permissions are supported on Android 12, to resolve this problem make sure to set the compileSdkVersion in your app/build.gradle file to 31.
for more information have a look at here

i update my flutter version Error in ruining flutter app

i update my flutter version to last update and i have error when in running my app
error:
Launching lib\main.dart on sdk gphone x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type 'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^
../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no method named 'debugFillProperties'.
super.debugFillProperties(properties);
^^^^^^^^^^^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method 'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
ifPresent: _completer?.toStringShort(),
^^^^^^^^^^^^^
../../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no method named 'debugFillProperties'.
super.debugFillProperties(description);
^^^^^^^^^^^^^^^^^^^
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\lenovo\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 896
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\Users\lenovo\flutter\bin\flutter.bat'' finished with non-zero exit value 1
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 52s
Exception: Gradle task assembleDebug failed with exit code 1
-- Run pub upgrade in the pubspec.yaml
-- Run pub get in the pubspec.yaml
-- Then run Flutter Clean
-- Restart your IDE
I faced similar error and that worked for me

error compiling my ionic app using ionic package

I am trying to build a release version of my Ionic app for android, using $ ionic package build android --release --profile profile_production, but I get the following error. Can you help please ?
Nota: ionic build android leads to no error.
:compileReleaseJavaWithJavac/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:11: error: package com.google.android.gms.auth does not exist
import com.google.android.gms.auth.GoogleAuthException;
^
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:12: error: package com.google.android.gms.auth does not exist
import com.google.android.gms.auth.GoogleAuthUtil;
^
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:13: error: package com.google.android.gms.auth does not exist
import com.google.android.gms.auth.UserRecoverableAuthException;
^
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:193: error: cannot find symbol
token = GoogleAuthUtil.getToken(context, email, scope);
^
symbol: variable GoogleAuthUtil
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:202: error: cannot find symbol
token = GoogleAuthUtil.getToken(context, email, scope);
^
symbol: variable GoogleAuthUtil
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:205: error: cannot find symbol
GoogleAuthUtil.clearToken(context, token);
^
symbol: variable GoogleAuthUtil
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:210: error: cannot find symbol
token = GoogleAuthUtil.getToken(context, email, scope);
^
symbol: variable GoogleAuthUtil
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:213: error: cannot find symbol
GoogleAuthUtil.clearToken(context, token);
^
symbol: variable GoogleAuthUtil
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:217: error: cannot find symbol
catch (UserRecoverableAuthException userAuthEx) {
^
symbol: class UserRecoverableAuthException
/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/src/nl/xservices/plugins/GooglePlus.java:227: error: cannot find symbol
} catch (GoogleAuthException e) {
^
symbol: class GoogleAuthException
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
10 errors
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 8.201 secs
Error: Error code 1 for command: /home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/gradlew with args: cdvBuildRelease,-b,/home/package/workspace/apps-bc689f0f-142/cordova/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
First time answering here, but this post worked for me, so I think I got to paste it here.
https://github.com/EddyVerbruggen/cordova-plugin-googleplus/issues/252
What i did change was the plugin installed, instead of the cordova normal plugin, i added the git one, like this code:
cordova plugin add https://github.com/EddyVerbruggen/cordova-plugin-googleplus --save --variable REVERSED_CLIENT_ID=myreversedclientid