How can I use ionic storage with capacitor? - ionic-framework

I am developing an android app using ionic, and instead of cordova I am using capacitor. When I try to run ionic cordova plugin add cordova-sqlite-storage command, it gives me warning [WARN] About to integrate your app with Cordova. Are you sure you want to continue?. Please refer the warning image.
I am not sure, should I press yes or no. I want to use capacitor.

You should continue to use the Cordova plugin. The problem is how you're adding it. Don't use the ionic cordova CLI command (as in don't ever use it in a Capacitor app). Instead, use npm install cordova-sqlite-storage and then update your Capacitor platform with npx cap sync or ionic cap sync.

I think you need to use capacitor-sqlite plugin for your application.
npm install --save capacitor-sqlite#latest
Here you can see the list of plugins that are available with a capacitor.
Capacitor Community Plugins
If you don't have complex queries in your application and simple storage only then you can use storage API.
Hope this will help you.

Related

Installing plugin the Capacitor way still requires the Cordova plugin

When I install for example the Insomnia plugin the Capacitor way like so:
npm install cordova-plugin-insomnia
npm install #ionic-native/insomnia
ionic cap sync
It still requires me to install the cordova plugin like this:
ionic cordova plugin add cordova-plugin-insomnia
In order to work. Otherwise it says: plugin_not_installed
My steps to make it work are:
Step 1: Add Insomnia to providers (#ionic-native/insomnia/ngx)
Step 2: Inject Insomnia within the constructor private insomnia: Insomnia
Am I forgetting something or do I just really need to ionic cordova plugin add for plugins that are not fully supported yet?
Probably obvious for most but just in case someone else might face this problem..
When you use capacitor you shouldn't start your server with ionic cordova run or ionic cordova build anymore.
Obviously you need to start it this way for livereload:
ionic cap run android -l --external
ionic cap run ios -l --external
That is because your application is using cordova and not capacitor..
Remove your platforms folder, and just to make sure and remove unnecessary cordova files which will increase your app size, remove cordova-android and cordova-ios from your package.json.. You do not need that for running your app based on capacitor.
Then, run this command.
ionic build
npx cap add android
npx cap add ios
For each successive build, in case you add or remove a plugin, use npx cap sync
Otherwise use npx cap copy
Reference Docs

Ionic 4 Angular 6 create app not asking Cordova Integration question

I'm new to Ionic, and just installed it and i also installed Cordova on my Ubuntu 18.04 machine, then i used the command to create an app using these commands
npm install -g ionic
npm install -g cordova
then i used the command to create an app using these
ionic start ionic4Tut --type=angular
but I'm not getting the question about integrating cordova to the project as shown in all the tutorials,
Integrate your new app with Cordova to target native iOS and Android? (y/N)
anyone know way is that?
I was having the same problem and what I did was after creating the project using
$ionic start projName --type=angular
I will cd to my project folder and run
$ionic cordova platform
that will solve your problem.
Cordova is what the Ionic framework uses to target native functionality for mobile devices. It does this because Ionic is primarily a mobile app framework. If you don't want to integrate it and want to use nothing but the development framework, you may as well use Angular on it's own.
Reference: Cordova, Angular, Ionic

Can i run the ionic v1 project when i have ionic CLI 3.0.0

Now i have the latest version of ionic 3.0.0. My ionic version: 3.0.0.
And my ionic info:
global packages:
#ionic/cli-utils : 1.0.0
Ionic CLI : 3.0.0
System:
Node : v7.3.0
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : 1.9.0
ios-sim : 5.0.13
Now i have two question in this. I searched , but not able to get the clear. If any one can answer. It will be helpful for many new bie like me.
So,
1.Now i have ionic 3.0.0. Then if i want to open the project in ionic v2. i will give ` ionic start newapp blank --v2 or (--ts_)'. And i will use some updated plugin having in ionic 3.0.0. Does it will work out. or i need to create a seperate project for ionic version 3 ??
Now i have old ionic 1 project that i am still working on. So once i update my ionic to3.0.0. Now what i done is :
ionic start newapp blank --v1 then i copied my old project www folder to this newapp and i replaced it.
My question is. Still can i use angular js1 to code for this project also. And while make ionic release means when i want to put it in my app store. Does any problem will occur. Because i have create this project as --v1.
If yes when i create a new project ionic start newapp blank --v1 its asking me Link this app to your Ionic Dashboard to use tools like Ionic View? y/N : what should i need to do
Please clarify me..thanks in advance
Using the ionic-cli version 3.0 you should be able to work on all versions of ionic projects.
The new cli will create an ionic v3 app by default. If you want to create an ionic v1 app, you need to add --v1. But if you are starting with a new app, I strongly recommend going for v2+.
Depending on the version your ionic app has, you need to add some additional plugins:
#ionic/cli-plugin-ionic-angular – Ionic Angular project plugin that provides useful build tools and generators. (ionic v2+)
#ionic/cli-plugin-ionic1 – Ionic 1 project plugin that has functionality ported from the old CLI.
#ionic/cli-plugin-cordova – Essential for an Ionic/Cordova app.
#ionic/cli-plugin-proxy – For proxying CLI requests through a firewall.
I can't tell you if you need to link your app to the dashboard. If you are using the Ionic services (Push, View, etc), then it makes sense.
That being said, I have experienced quite a few "bugs" or inconsistent behaviour with the new cli, so you might need to downgrade if something doesn't work.
I had this same worry when I updated my Ionic to v3 (CLI 3.1.2). They seem to really be pushing to use their cloud services (obviously, they want to start making some money on it).
When I tried the old v1 command:
ionic build ios
I received:
The build command has been renamed. To find out more, run:
ionic cordova build --help
So, then I tried
ionic covdova build ios
That failed with this:
ionic package build ios
[ERROR] Your project file (./ionic.config.json) does not contain 'app_id'. Run ionic link.
So, after looking around a bit, I used this command and it worked:
ionic cordova build ios --v1
It asked me to install a couple of things, then chugged out a new successful build. All good.
Please use following command as I had trouble with "--v1"
ionic start newapp blank --type=ionic1
As mentioned by #Samuel.
Add Ionic 1 CLI to the devDependency list. Open package.json file in the project directory and add the following line to devDependencies.
"#ionic/cli-framework": "^1.0.0-rc.2"
Example package.json:
Running ionic repair removed package.json and node_modules then, if prompted, run npm audit fix, and then you will be asked to Install #angular/cli?

How do I install a specific version of crosswalk using ionic cli2

I currently have an ionic 1 project, but have just switched to using ionic cli2. I previously used to add crosswalk into my project, by running the following command, as mentioned here.
ionic browser add crosswalk
However, ionic cli2 no longer supports the browser command, and I am unsure how to install it in the correct way.
Any help would be appreciated.
It seems the answer is as follows:
I need to run
ionic plugin add cordova-plugin-crosswalk-webview

Installation for ionic framework

I am new to ionic framework. I need help for development with ionic. Please suggest me the necessary software to be installed on local computer for developing ionic app. I also need the software for emulating the app on AVD. And deploying the app on mobile.
All the questions you are asking, and more, are answered on ionic framework getting started page.
If you have a problem with a specific step, you should ask a specific question about it.
Next time please first start with searching by yourself but anyways:
Install NodeJs
Install Ionic with Ionic CLI:
npm install -g ionic cordova
then start your Ionic Projekt with
ionic serve
And to test your App on AVD use Genymotion.
Or just use Ionics DevApp for Android & iOS.
Or publish your App as APK or IPA like explained here