background_locator_fixed
background_locator_fixed copied to clipboard
Android app crashing while on location service. in share build via google drive link and diawi link
java.lang.RuntimeException: Unable to start service yukams.app.background_locator_2.IsolateHolderService@c2a45c6 with Intent { act=UPDATE_NOTIFICATION cmp=com.techguy/yukams.app.background_locator_2.IsolateHolderService (has extras) }: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=app.yukams/locator_plugin pri=1 contentView=null vibrate=null sound=null defaults=0x0 flags=0xa color=0x00000000 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)
Caused by: java.lang.IllegalArgumentException: Invalid notification (no valid small icon): Notification(channel=app.yukams/locator_plugin pri=1 contentView=null vibrate=null sound=null defaults=0x0 flags=0xa color=0x00000000 vis=PRIVATE semFlags=0x0 semPriority=0 semMissedCount=0)
Hello buddy i am using this version. 2.0.6-dev.1 And the android app crash in release build while stating the location service
runBackGrounLocation() async { AppUtils.showToast("11111111"); FirebaseCrashlytics.instance.recordError("runbackground",StackTrace.empty); var rrr1 = await AppUtils.checkLocationBackGroundPermission(); if(!rrr1){ return; } try{ port = ReceivePort(); if (IsolateNameServer.lookupPortByName( fetchBackgroundLocation) != null) { IsolateNameServer.removePortNameMapping( fetchBackgroundLocation); } IsolateNameServer.registerPortWithName(port.sendPort, fetchBackgroundLocation); //port.listen((dynamic data) async {},); AppUtils.showToast("222222222"); FirebaseCrashlytics.instance.recordError("22222222222",StackTrace.empty); await BackgroundLocator.initialize(); _startLocator(); }catch(e){ AppUtils.showToast(e.toString()); }
}
Future
}catch(e){
AppUtils.showToast(e.toString());
FirebaseCrashlytics.instance.recordError(e.toString(),StackTrace.empty);
}
}
static Future
}
class LocationCallbackHandler {
static Future
static Future
static Future
} }
The same error with notification
I have fixed this by setting the notification icon:
notificationIcon: 'launcher_icon',
It is located in the "mipmap" directories in the Android folder
androidSettings: const AndroidSettings(
accuracy: LocationAccuracy.NAVIGATION,
interval: 5,
distanceFilter: 0,
client: LocationClient.google,
androidNotificationSettings: AndroidNotificationSettings(
notificationChannelName: 'Location tracking',
notificationTitle: 'Start Location Tracking',
notificationMsg: 'Track location in background',
notificationBigMsg:
'Background location is on to keep the app up-tp-date with your location. This is required for main features to work properly when the app is not running.',
// notificationIcon: 'ic_stat_ac_unit',
notificationIcon: 'launcher_icon',
notificationIconColor: Colors.grey,
notificationTapCallback: LocationCallbackHandler.notificationCallback,
),
),