Dominik Jelínek Dominik Jelínek - 5 months ago 31
Android Question

Work with files in cordova and Ionic - compatibility iOS, Android

For this question I have created compatibility test project on GitHub.

Initial state is set only to Ionic View application.

Ionic Browser

ionic serve
show output as on picture ionicBrowser.png.

But If I uncomment in
www\js\index.js
line 32 and 33, then


  • fileSystemRequest (webkitRequestFileSystem) is fine,

  • fileEntry is fine,

  • writing and reading file works as well.



Ionic App

For command
ionic upload
, the output on Android Device is as on picture ionicView-android.png.

iOS show me view output as on picture ionicView-ios.png.

Native Application build by Ionic

Command
ionic package build android
got me output on Android only with device ready event. Reason is I didn't add cordova-plugin-file to
package.json


...,
"ionic-plugin-keyboard",
"cordova-plugin-file"],
"cordovaPlatforms": []
}


After correction, I have got output nativeAndroid.png

In general, I can work with files only on Android devices (Ionic View or as an Native App).

I can't work with files on iOS in any possible way and this is my problem. I need work with files on iOS devices. I have thought that Cordova and Ionic make common environment, but this doesn't happens.

Do I something wrong?

Update 1



I have tried build up application as a native package for Android under Windows by command
ionic run android
.

For this testing I have used Android device with Android 4.2.9 and Android emulator as well.

Don't forgot for
ionic plugin add cordova-plugin-file
.

Don't forgot for
ionic platform add android
.

I have got same view as on nativeAndroid.png.

Update 2



I have used for this task Mac mini OS X El Capitan (10.11.5).

I have got problem with editing text files, so I have prepared everything on Windows and moved project to Mac.

I have worked with ionic view (
ionic upload
) and
ionic package build android
and
I have got same views (nativeAndroid.png, ionicView-android.png).

Answer

I have tried build up application as a native for iOS in OS X ... by command ionic run ios.

For this testing I have used iOS emulator.

Don't forgot for ionic plugin add cordova-plugin-file.

Don't forgot for ionic platform add ios.

I have got same view as on nativeAndroid.png.

Everything works, universe is saved.

Result

I need still test ionic view on iOS device (run ionic upload on OS X ...).

Probably development with ionic and cordova is platform oriented. If I want deploy iOS app, need Apple machine (Android on OS X is fine - see above - I mean ionic package build android).

Comments