Unable to use local storage in flutter web view - flutter

I am using flutter_inappwebview: ^5.3.0 package in my app, i am achieving every requirement of my app except I can't upload picture in my web view.
As soon as i click the icon the app crashes.
I have tried achieving this with flutter_webview_plugin but there are number of other issues i can't solve with that, so i decided to give inappwebview a try, but i am stil stuck at this.

On Android, you need to add the following codes inside the tag of your android/app/src/main/AndroidManifest.xml:
<provider
android:name="com.pichillilorenzo.flutter_inappwebview.InAppWebViewFileProvider"
android:authorities="${applicationId}.flutter_inappwebview.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/provider_paths" />
</provider>

Related

How to set a Flutter Custom Notification Icon ?,because there is no default notification icon in flutter for fcm

I want to set a custom notification icon to appear in my notifications panel for my flutter app when i use fcm(firebase cloud messaging) but there is only a grey circle that appears and no icon .
After Searching for a long time i finally found the answer and here it is:
Create a custom notification icon using this tool.
Paste the generated list of icons in android/app/src/main/res.
Go to your manifest android/app/src/main/AndroidManifest.xml and add the following meta data in the application (not activity) tag:
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="#drawable/ic_notification" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="#color/colorPrimary" />
If you don't have a colors.xml in res/values, create one:
Done! It should work, let me know if it doesn't.
Discussion for the question is here.

Flutter splash screen not showing

I'am trying to add a splash screen on my application , i'am pretty sure i made all the steps correctly
I've added my picture on launch_background.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="#android:color/black"/>
<item>
<bitmap
android:gravity="center"
android:src="#drawable/1-ZID-SplashScreen" />
</item>
</layer-list>
And i have added the path of the picture which is located on drawable folder on pubsec.yaml
flutter:
assets:
- assets/images/
- assets/google_fonts/
- android/app/src/main/res/drawable/
But still the splash screen stills white, help me resolve this please ^^
Thanks.
You can use flutter_native_splash it will help you achieve what you want
You can add a native splash screen to your app in 02 ways.
Using flutter package.
This is the easiest way to add a splash screen for your flutter app. (You don't need to have prior Native android & ios development knowledge).
Link to package:- package
This video shows that how to use this package:- video tutorial
Without using flutter package (Native way)
For this method, you needed to have prior native android & ios development experience.
If you had native development experience, you can use the below links to see the steps.
Link
As I know, the ressource name (in your case "android:src="#drawable/1-ZID-SplashScreen") should start with a letter not a number (google the android ressources naming convention for more information).

Flutter app shows a black screen before loading the app

I have noticed this problem with flutter apps, when I open a flutter app from cold boot, I see a black screen popping before the actual app is loaded. I have seen the problem with the Newsvoice production app and as well as with a test app I installed.
Check the video here: https://www.youtube.com/watch?v=zszud6UWzps
Is it a bug in the Flutter SDK?
This issue was fixed recently. If you are using a version of Flutter that has this engine fix, you won't see the black frame. (The fix should be on the Flutter master branch by now, but not the alpha branch.)
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/my_splash"
/>
AndroidManifest.xml check the FlutterActivity and add this code
It's not issue, this for hot reload. Don't worry about that. When you run with release, you can't see this.
if you want to be sure try ->
flutter run --release
It's not a bug. That's the way it behaves normally. You can replace the loading black screen with an image:
In AndroidManifest.xml, here is where you can change your splash image.
<meta-data android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="#drawable/launch_background" />
Find the files:
android\app\src\main\res\drawable\launch_background.xml
android\app\src\main\res\drawable-v21\launch_background.xml
Change the files to add your own custom image:
<item>
<bitmap android:gravity="center" android:src="#drawable/splash_image" />
</item>
Your splash image should be stored in the drawable folders:
android\app\src\main\res\drawable\splash_image.png
app\src\main\res\drawable-v21\splash_image.png
I can solve this issue, after removing FutureBuilder when using Firebase. just initialize Firebase app on main() like this
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
instead of using FutureBuilder on your build method
The black screen is something which comes for a variety of reasons is what I have gathered from looking at different responses on the net. In my case I realized on thing, that my Firebase.initializeApp() was returning an error in the snapshot of my FutureBuilder due to which no widgets were being rendered. I tried everything to no avail. Finally I moved my project to a completely new folder as described here
and then my black screen issue got resolved.

Open QuickContactBadge from home screen widget Android 4+

I am trying to show the Quick Contact Badge from a home screen widget which shows the favourite contact pictures in a grid layout. I went through the tips here but still I cannot figure it out.
When I click on a contact I always get the following error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.gridwidget/com.example.gridwidget.ContactBadge}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.android.contacts.action.QUICK_CONTACT
despite I am calling the 'ContactsContract.QuickContact.showQuickContact();' from an activity.
This intent is causing the problem: com.android.contacts.action.QUICK_CONTACT
I tried to add it in my manifest file without success:
<activity
android:name="com.example.gridwidget.ContactBadge"
android:label="#string/title_activity_contact_badge"
android:theme="#android:style/Theme.NoDisplay" >
<intent-filter>
<action android:name="com.android.contacts.action.QUICK_CONTACT" />
<action android:name="com.example.gridwidget.BADGE_ACTION" />
</intent-filter>
</activity>
Any suggestion? Since I am showing a collection, I used the RemoteViewsService pattern as described here
Thanks
I found the problem. The URI I was passing to ContactsContract.QuickContact.showQuickContact() was badly formatted.
It is working properly now

Android: two tasks - two launcher icons

I have an activity A (i want that work in background) that start activity B with code
moveTaskToBack(false);
Intent intent = new Intent(context.getActivity(), BActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
startActivity(intent);
In manifest i have
<activity android:name="ru.nekit.BActivity"
android:label="B"
android:taskAffinity="ru.nekit"/>
When start activity B and press Home button i see that there is two launcher icons
Question how can i do that wiil be only one launche icon?
Your app may have multiple activities found in your launcher based upon your manifest file and the XML attribute:
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
For each activity that you list containing this attribute, you will have another icon found within the Launcher for that activity. Make sure you only have this attribute set for the activity you want to display in the launcher.
You may also have installed multiple versions of your app when developing if you ended up changing the application name somewhere along the way. Be sure to uninstall all previous versions.