What is the difference between getApplicationSupportDirectory and getLibraryDirectory? - flutter

As an Android developer, I am pretty familiar with native getFilesDir function, which is provided by path_provider's getApplicationSupportDirectory. I noticed for iOS there is another function called getLibraryDirectory with pretty similar description in path_provider's docs. But the docs are not much clear about it. What is its purpose and when to use this instead of getApplicationSupportDirectory (or getApplicationDocumentsDirectory)?

getLibraryDirectory function is used when the application is supposed to store the persistent data like backup files or database. It is used in iOS devices as in android it is not supported and throws exception.
getApplicationSupportDirectory function is used for application data which probably resides inside Android folder in android devices. It can be used for both iOS and Android devices. If the path doesn't exists it will create the directory. All the data will be wiped out if application is uninstalled/removed.

Related

How can I access device information without using packages in Flutter?

How can I access device information without using packages in Flutter? How can I get the information of the device where the app is installed in my Flutter app?
First, you'd be better off using packages. But if you really want/need to do it, you'd have to write platform-specific code code in the native language of the targeted platform (ie. Swift or Objective-C for iOS/Mac, Kotlin or Java for Android, etc), then use so-called platform channels to pass messages between your app and the platform-specific code.
If you'd like to get details about the device, on iOS you'd use UIDevice, on Android you'd typically want Build.
This can only be done through Method Channel

Changing published mobile application developing language from ionic to flutter

I have a mobile application developed using Ionic. Now I want to redevelop it in flutter and publish a new update, would that be possible? will google play and AppStore allow that?
There is no constraint on development language. But,
You need to use same certificates/keys for iOS App
You need to use same key-store/keys for Android App
If you are using local database or file storage, then you should follow the same path in your newly created app as well. If you are using any third-party library to manage the db or file paths, then it may be in different location altogether. (This one actually happened to me. When I migrated my app from a cross-platform framework to Native the database path got changed in release version)

How to connect to an iphone through Java? Is this even possible?

I am trying to write a program in Java that can connect to an iPhone that is attached to a computer via apple USB cable and view its files. I have not found anything like this online and have been wondering if this is even possible. Any suggestions?
iOS is problematic because of DRM. Android is also moving in that direction making standard file system browsing difficult so I doubt it would be possible to view arbitrary files on the device.
Codename One allows you to build a Java app that will run on the iPhone itself which might allow you to access some data. However, apps running in the device also have restrictions and can't access the full file system only their own.

ANE for one platform on Flex mobile project for iOS and Android

I'm very new at Flex Mobile Projects and native extension.
I have a big doubt... If I have an ANE that only works on iOS or Android, can I use it into a project for Android AND iOS?
I mean, if I want to do something and I've only found and ANE that works for iOS and another ANE that works for Android, can I create only one project and depending on the device use one or another? or should I create two different projects?
Thanks in advance
You should be able to correctly code using two different ANE's, one for each platform, but it does really depend on the ANE.
Most provide a isSupported flag to allow you to determine programmatically whether the extension is supported on the current platform.
if (ExtensionA.isSupported)
{
// Use extension A
}
else if (ExtensionB.isSupported)
{
// Use extension B
}
It's also worth noting that if the extension isn't correctly implementing a "default" version (i.e. one that gets used on unsupported platforms) this may fail. Really comes down to the ANE implementation.

Possible to share SQLite DB between PhoneGap and Native code?

I am writing a native iPhone and Android app using Sencha Touch inside Phonegap and my client is very keen for me to include Analytics.
The application needs to function happily offline so I need an analytics solution that can remember activity occurring while offline and updating the server once online again.
My thoughts are to store events from within the JS to a store that can be checked at a regular interval on the device and posted to the server.
My question is whether a SQLite DB could be used for this using the Phonegap API and whether this DB could then be accessed from the native code?
I suspect not and that the best option would be to write to a text file.
Any thoughts or suggestions gratefully received.
The solution to this seems to be to write a Phonegap Plugin that lets you call a method from inside Phonegap to a method in your native application.