Addition of plugins to React native app without using expo and without modifiying AndroidManifest.xml and info.plist files - plugins

I would like to add plugins like camera, scanner in an react-native-app but this involves addition of some additional code into AndroidManifest.xml and info.plist file for enabling plugin permissions
Whereas I would like to add the plugins at one place and it should update in appropriate Android and iOS files, similar to that of config.xml file configuration in cordova apps.
Are there any libraries available to implement in this way ?
Thanks

Unfortunately no. Adding libraries that deal with permissions has always been a bit of a struggle in react native, where you have to touch the android and iOS files and often times specify why your app requires those permissions in the first place. It gets a bit more complicated as different android versions have different ways to deal with permissions.
The good news is that most of the libraries you'll want to add provide a detailed documentation on how to set them up properly which does not take too long after you get the gist of it.

Related

Flutter Basics (write once, run anywhere?)

Hi stack overflow community,
I'm a novice programmer in high school and have never written an app for mobile devices before so please bear with me. If I was to write an app using Flutter, will I only be required to write the code once and then be able to distribute different versions of it (iOS, macOS, Windows, Linux, Android, etc)? Or will I need to make small changes for each version such as using XCode to create the iOS version and Android Studio for the Android version? I know this is such a basic question but I've spent a couple of hours looking this stuff up and I'm still confused. Any help would be nice.
Thanks,
Daniel
In a product development environment, after writing the cross-platform code with Flutter, there are some need-to-do tasks related to Native environment.
In the case of Android, there are several cases when you'll need to touch the Native level such as config Firestore settings, Social authentication (Login with Facebook for example), changing the launch icons/ splash screen of the app or publishing to app store, etc
For iOS, the same case apply as well. So I suggest you start with small steps to develop the app first, then when running into something that seems impossible with just Flutter code, there are tutorials and SO to guide you through. It might seem overwhelmed at first, but we are all on a journey, so no need to rush it ;)
You should make small changes too. For eg when adding launcher icons and splash screen you have to edit the respective native folders. When distributing for ios you need to manually customize its Runner from xcode. There are many library that support either android only or ios only. In that case if you need that feature you have to make changes in native code like java ans swift.
if you're creating your own native plugins, you will have unique code to write. But if you're just using things out of pub, almost nothing will require change (unless you are publishing to the store).

is it possible to embed an ionic application within a flutter application?

To be more precise, I already have a huge app writen in Ionic and now we're considering to migrate it to flutter, but we can't rewrite it from scratch, both ionic and flutter should coexist.
So my question is: can I have a flutter app as a "host" and import / run the ionic app inside it? Something like a micro frontend.
Until now I was able to build the target ionic app and import it on the flutter app, under android folder, but it does not feels like a productive way to approach the problem.
I also googled a little bit about this integration, but did not find anything that solves this problem.
I appreciate any help on this topic.
Yes, it is possible, but very cumbersome.
I did it for a project and embedded 3 ionic apps inside flutter.
I'll not list every problem that i faced but just go through some points to give you an idea.
You will need to take care of some cordova plugins that use native code, for Android copy and paste some folders like CordovaLib,cordova and use it as a library. For iOS you must add the plugin files like *.h to the compiles list inside Xcode and create an Pod to get the cordova resources (that's the way i did)
To "launch" the app for android you need to start the cordova activity and for iOS you need to play with UINavigationController and FlutterViewController, and of course create a method channel to be possible to call it from Flutter.
For multiple apps, you have to mess inside de cordova code to get the app from the right www folder and be sure to equalize every plugin version between apps.
Some packages from flutter may clash with ionic/cordova libs
Every change you do to your ionic application it must be tested outside flutter and within it to see if there's any mismatch behavior that you didn't expect, specially when adding new plugins.
Maybe some permission issues will arrive between applications like camera or localization.
I know thats not the answer, but when searching on how to do it, i stumbled upon this question a few months ago and it still without any answer on this problem.
But my final take is that the effort of joining together all pieces using multiple languages and frameworks together with the job of maintaining this spaghetti behemoth is not worth it and you'll save yourself of a tremendous headache.

Flutter - Am I able to creat a module with Flutter and use it in my iOS and Android projects?

In my company, we are working on a huge product. We have a repo for the Android project and also we have another repo for the iOS project.
I think it is impossible to rewrite the whole of the project in Flutter. So, something that popped in my mind but I am not sure if it is feasible. Each Android/iOS project contains many modules. I am working on a module called Enterprise. It has its own Activities, Fragments and business logic. So, my question is, Am I able to consider this module as a black box (it has a few inputs that are coming from the other modules and a few outputs that will be presented in the app module) and make it by Flutter. Then I will use its .aar version in the Android project as well as the iOS project.
Does an implementation like this is feasible?
Okay, I found Flutter is thinking of a way to solve this issue. I found two links that might be useful to you, too:
Add Flutter to existing apps. According to this page, "The "add-to-app" support is in preview, and is so far only available on the master channel.".
Integrating Flutter into an Existing App.
I will be more than happy to accept your answer if you have a better approach.

Better path_provider

just wondering if there is any way to access files on the system. not just the directories provider by path_provider?
seems like this should be part of core flutter, or at least a package. maybe most flutter apps don't require files from elsewhere (or maybe most apps in general, I'm just starting out)
I want to scan the file system for audio files. I know I could do it in android, as I made a little demo app to try some things with native code
The issue is that each platform is very much different, both in what you're able to do and how files are arranged.
The path_provider does actually have a way of getting the external files directory: getExternalStorageDirectory. However, that only works on Android as iOS doesn't allow reading files outside the app's sandbox. But once you use that you can use dart:io's File and Directory classes to read the files.
You also need permission on android to be able to read files. Putting this in your manifest should do it, but there's tons of android-specific answers that will tell you more.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Note that on iOS, there are ways to access specific types of files (i.e. pictures and videos), just no normal filesystem access.
Also note that if you've already done in android native code, you can use platform channels to interface between flutter and the native code.

Unity3d android game adding multiple plugins issues

I am noob in unity3d game development.I wants to add two plugins FB and ADMOB, both individually works fine. But i am not able to keep both together. because both contains its different androidmanifest.xml, I knew it might be problem of android manifest conflict of duplicate jar. Or anything else. How can i solve it?
thanks.
Instead of relying on any individual android manifest, you should write your own android manifest for your own application, uniting the two manifests of the plugins that you're using. This page can help you on writing down a correct manifest. Also, just by googling "unity android manifest merge", you can find posts from a lot of people solving various individual issues relating to merging android manifests, like this, this and this.
First you need to install Facebook plugin, and then follow this instruction.
Facebook and Google AdMob plugins don't require to extend Unity's main Activity.
You can find more information regarding those plugins at this WebSite.