how to change app icon and name dynamically in flutter(ios/andorid) both - flutter

i want to change app icon and name dynamically in flutter for ios and android both i already know about flutter_dynamic_icon but its work only for ios but i want to change for android also
is possible to change app icon from local storage or from server
for ex. user select image from gallery/local or click via camera and set to app icon?
try {
if (await FlutterDynamicIcon.supportsAlternateIcons) {
await FlutterDynamicIcon.setAlternateIconName("photos");
print("App icon change successful");
return;
}
} on PlatformException {} catch (e) {}
print("Failed to change app icon");
...
// set batch number
try {
await FlutterDynamicIcon.setApplicationIconBadgeNumber(9399);
} on PlatformException {} catch (e) {}
// gets currently set batch number
int batchNumber = FlutterDynamicIcon.getApplicationIconBadgeNumber();

Related

Flutter lost focus on phone if Android Auto runs Waze

I launch Waze from App with this code with button click:`enter code here
void launchWaze(String lat, String lng) async {
Uri url = Uri.parse(
'https://waze.com/ul?ll=$lat,$lng&navigate=yes');
Uri fallbackUrl =
Uri.parse('https://waze.com/ul?ll=$lat,$lng&navigate=yes');
try {
bool launched = await launchUrl(
url,
mode: LaunchMode.externalApplication, // or externalNonBrowserApplication,
);
} catch (e) {
await launchUrl(fallbackUrl);
}
}
Waze launched from app, on Android Auto starts and route is fine, but the focus not in my app anymore so I can not use the app to start other location, only a text you use Waze on Android Auto. Back button not working...
Is there any solution to navigate on Android Auto and use the app on phone the same time?

How to open subscriptions page in Play Store in Flutter

I want to edit my active subscription and for this I need to go to the play store.
Forcing the user to open the play store first, and then go to the settings page, and then open subscriptions is not suitable. Can this be done somehow in 1 click (not in browser)?
Options with opening in the browser are not suitable. I need to open the page with all subscriptions (https://play.google.com/store/account/subscriptions)
I need a redirect link market://...
Thank you!
I tried next packages: url_launcher, store_redirect etc.
Methods like: `
final Uri url =
Uri.parse('https://apps.apple.com/app/MyAppName/idXXXXX');
try {
if (await canLaunch(url.toString())) {
await launch(url.toString());
} else {
throw 'Could not launch $url';
}
} catch (e) {
print(e);
}
and
launchUrl(Uri.parse('https://play.google.com/store/account/subscriptions?sku=pro.monthly.testsku&package=com.example.app'));
I had to use only this method:
final url = Uri.parse('http://play.google.com/store/account/subscriptions');

How to send what'sapp message to any number from flutter?

I am using an api to get users data and i want to send messages to every users what's app number on click in flutter app. How to do this ?
https://www.youtube.com/watch?v=-wW2ZoDuFO4&t=391s
if windwos platform u can see my video
Use the plugin.
https://pub.dev/packages/url_launcher
final url = "https://wa.me/91XXXXXXXXXX?text=Hello";
//do not forgot to enter your country code instead of 91 and instead of XXXXXXXXXX enter phone number.
if (await canLaunchUrl(Uri.parse(url))) {
await launchUrl(Uri.parse(url));
} else {
showSnackBar(message: "Can't share link", title: "Error");
}
if (!await launchUrl(Uri.parse(url))) throw 'Could not launch $url';

How I can detect first app lauch in Flutter?

I work on a Flutter mobile app and I want to detect the first app launch to show a little tutorial to the user. I have tests the Shared-Preferences Module But when If I start the app for the first time The console tells me the key is not recognized, I think it's normal because this key does exist! There is another method for checking that?
Thank you guys
use shared preferences to store value that indicate if user has ever been in this page or not
like this
try {
final SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
splash = sharedPreferences.getString("SPLASH_DONE");
} catch (e) {
print("this is first time");
}
if (splash == null) {
page = AppSplashScreen();
} else {
page = LoginPage();
}
and after completing your first time operation call
sharedPreferences.setString("SPLASH_DONE", "DONE");

permission denied to access media from storage in multi image picker

i am uploading images from gallery to app, my app ask for permission automatically but dont know what happen now it is not asking for the permission and getting error "permission denied " when i try to open gallery in the app
loadGallery() async {
List<Asset> resultImages = List<Asset>();
try {
resultImages = await MultiImagePicker.pickImages(
maxImages: 10,
selectedAssets: images,
);
} catch (e) {
print("error is : $e");
}
setState(() {
images = resultImages;
});
}
In your AndroidManifest.xml file located in android/app/src/main, include these lines,
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
under the "<manifest.." tag.
There can be many scenarios that can be in the picture.
1) Maybe you have clicked on the permission for never option, where it does not asks permission later.
you have to check if you have the permission for accessing I have written the code check it just wrote an example, modify accordingly
check out the below Code for asking the permission
Future<bool> checkAndRequestCameraPermissions() async {
PermissionStatus permission =
await PermissionHandler().checkPermissionStatus(PermissionGroup.camera);
if (permission != PermissionStatus.granted) {
Map<PermissionGroup, PermissionStatus> permissions =
await PermissionHandler().requestPermissions([PermissionGroup.camera]);
return permissions[PermissionGroup.camera] == PermissionStatus.granted;
} else {
return true;
}
}
later only check if you have permission then do the required process.
if (await checkAndRequestCameraPermissions()) {
File image = await ImagePicker.pickImage(source: ImageSource.camera);
// continue with the image ...
}
for time being i have used the image_picker you can use Multi Image Picker.
check out the code and let me know.
Thanks.
Try to change the version of multi image picker it will work.. if you are using latest version and still received same problem then change it to old version.