Calling an activity from jquery in cordova - android

I am new to cordova so wanted to know if it is possible or not.
I have a functionality to implement, which I think I will be more comfortable in android native activity.
So can I call the native android from an html page or through jquery and the vice versa.

You need binding JavaScript code to Android code (bridge)
See official documentation

here is a good tutorial
http://itsmycodeshare.blogspot.in/2016/01/create-custom-cordova-plugins-using.html
and this is basic plugin example which interacts with js from Android java
https://github.com/don/cordova-plugin-hello
add your further activity and other code in <plugin_name>.java in src folder.

Related

using loadUrl()

It's been a few years since I've tried to create an Android application and since everything has moved away from Eclipse and now onto AS my old templates no longer work. I'm looking for tutorials that allow me to use my own custom html, css and Jquery, seeing as stuff like super.loadUrl("file:///android_asset/www/index.html"); don't seem to work anymore.
Are there any links or anything anyone can provide to get me started on creating non java dependant application?
If you want to make an app without using java you can start learning ionic framework https://ionicframework.com/
You can also go through Apache Cordova. It allows you to use standard web technologies such as HTML5, CSS3, and JavaScript for cross-platform development and you can also go with Xamarin that uses C# for cross-platform development.
You can also go through this tutorial for better understanding and for start learning from fresh :
Ionic tutorial https://www.youtube.com/watch?v=0jamhGf-8ww&list=PLYxzS__5yYQljbuGjaeugpqs9U07gS5P5
Cordova Tutorial https://www.youtube.com/watch?v=kqWZuEpHoSw&list=PLReL099Y5nRd9BNsMZwXvTDeqnfRMiGJy
Hope this will be helpful!!

Does Android Studio supports AngularJS for Android UI design?

I have a question about Android Studio: Does AS supports AngularJS code while designing XML files, e.g. for small animations or effects?
SUMMARY : NO
There is no way you can write Angular JS code while developing Android Native app. You can use Angular in a WebView (using js/html so), that's all.
AngularJS is a completely different technology than what is used in native Android apps. Native Android apps use Java and/or C for their code, which is compiled when you build the app. AngularJS is a framework for web development, running specifically on Javascript (a completely different technology than Java).
You can build apps without using native Java or C code, but there are tradeoffs. As noted in other answers, you can display webpage views as apps (using technologies like Cordova]), or use frameworks like React Native to write code in Javascript that then gets compiled to a native app. You could use AngluarJS in the webview instance, since it just displays a webpage, however not in something like React Native. I highly encourage you to check both of these (and other options) out, but keep in mind that they have their own limitations and tradeoffs – no one way is the "right" way to build an app.
In summary: No, AngularJS is a web technology, not a native app technology.
new answer = Yes... Sort of, you can do it with:
https://www.nativescript.org/
It translates javascript, angular and typescript code into native components!
Apparantly it's possible to use nativescript in Android Studio with:
https://docs.nativescript.org/runtimes/android/getting-started/hello-world
Android Does not support AngularJs. but still if you want to use you can use it in webview.

Use phonegap features in an existing android application

I am new to Phonegap. I need to use cordova webview in my existing application.
Can someone help me out, if I can use it in my existing android application by adding jar files.
I have checked these in Phonegap/cordova tutorial pages, but it didn't gave me much satisfaction. Also, if someone can provide the steps, it would be much appreciated.
Appreciate your help!!!
Use this guide
http://docs.phonegap.com/en/3.5.0/guide_hybrid_webviews_index.md.html#Embedding%20WebViews
and let us know where you have the problem.
You can also follow this blog post from one of the cordova team
https://web.archive.org/web/20140514125044/http://www.infil00p.org/advanced-tutorial-using-cordovawebview-on-android/
This would be a good resource. Complete step by step guide.
Embedding a Cordova WebView into an Android fragment
This tutorial demonstrates how to embed a Cordova WebView into an
Android fragment. The Phonegap documentation already provides a good
overview on how to embed a Cordova WebView in an activity however
there are some key differences when using Fragments.
www.youtube.com/watch?v=sQXHDIe7bVU
and check this.
How to implement phonegap/cordova in android webview?

Can we use native code as plugin in Rhomobile?

I need to run a java code for Android inside Rhomobile app. Is there any way i can call the java code. I have seen some of the plugins to interact with native codes for Android.
I tried searching and i did get to this url http://docs.rhomobile.com/rhoconnect/plugin-intro.
But i guess this is not for Rhomobile if i'm not wrong.
I have a library file for my requirement. Is there any way i can use it ?
Yes you can. Have a look at this http://docs.rhomobile.com/rhodes/extensions#native-extensions
The link you get is for RhoConnect ( basically meant for sync operation). You need to look into the native extension for Android : Rewriting the Generated Native Extension Source Code for Android
If you need some more help and support, you can go over
https://developer.motorolasolutions.com/‎
https://groups.google.com/forum/#!forum/rhomobile
You can also simply post you query here and tag Rhomobile & Rhodes.
Hope this might help you.

Running JavaScript methods from Java in Android

I am writing application using PhoneGap on Android. I need to call some PhoneGap methods from native Java code. Anyone knows how to do that??
If you write your native code as an Android plugin (see an example here: https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner) then you have access to all of the PhoneGap Java classes and can call them as you like.

Categories

Resources