Can we use phonegap javascript library with a regular internet site? - javascript

If i develope a regular Website using the phongap.js library, Will it still works on mobiles
(with access to goelocation,media,device,events etc...) Without turning it into an application?
(without using the SDKs or phonegap build)?

No, phonegap.js has hooks to the native systems. It has to have the native objective-c and Java files in order to work and access those features.
You can however use HTML5 geolocation for geo, but other than that you're very limited.

Unfortunately no. Phonegap API's only interface with phones and mobile devices when running within a wrapper which provides those extra features. The JavaScript calls can not function without the platform-specific libraries there to support them.
Further reading:
http://groups.google.com/group/phonegap/browse_thread/thread/cde8e4735dd6da9d
http://paulparisi.com.au/2011/09/26/adventures-in-reverse-engineering-a-phonegap-app/

Again, no. The PhoneGap library must be compiled, something which is not offered via web applications served directly from urls.
You'll often find whilst debugging an error we have been fighting with for quite sometime, which is "com is not defined."

Related

Windows 8 Metro and Google Analytics

Will it be possible to use the Google Analytics JavaScript library (https://developers.google.com/analytics/devguides/collection/gajs/) for the Windows Metro JavaScript based application to trace views accessed by user?
In general, if a JavaScript library you want to use is on a CDN or a server external to your app, the answer is no, as Windows apps written with HTML/JavaScript cannot load external JavaScript libraries...if you try, a security exception will occur.
Many libraries will work fine if you copy the JS file into your project and run it locally. For example, jQuery works just fine this way. I have not tried the Google Analytics library, so you might just want to test it out and see if it will work with a local copy.
Something else to consider, however, is that unlike a web site, a Windows app written in HTML/JavaScript may occasionally be offline, in which case, a library written with the assumption of network connectivity would likely not work. So in this particular case, you might not get the data that you're hoping for.
Hope that helps.
we tried http://w8ga.codeplex.com/ (w8ga) to work with GA in our win8 js app.
Currently W8GA seems doesn't support html/js. Also I have no idea why developer didn't mension it( it's supports only c#/xaml metro app )
So, we found another way to do it; Look for cobra Tab 's answer at the bottom of this page: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/f81ebbb9-d711-40f1-8a82-9aed44e2d8fe/
And finally, we are waiting Adobe's Omniture sdk:
http://microsite.omniture.com/t2/help/en_US/sc/appmeasurement/winrt/index.html#Developer_Quick_Start
Hope these answers helps...
We're using the free version of markedup in our applications with great success. In addition to simple page views it shows you some app specific numbers like number of installs, exception details, etc.
I'd recommend using the Google Analytics SDK for Windows 8 and Windows Phone. It is built as a WinRT component and therefore supports both JS & Xaml Win8 apps.
Full disclosure: I am the author of this SDK; I built it for my own app and decided to open source it. There are other frameworks out there but AFAIK, none of them support the new GA universal analytics protocol so they only work with older GA properties and don't support all the cool new features GA recently added just for apps.

Writing apps for Apple platforms with Javascript

Does Apple allow iOS and Mac apps to use Javascript? Can someone give me examples of how to use it and the advantages and disadvantages?
If you're looking for a less techy solution, you could also use AppFurnace ( http://www.appfurnace.com ) to create JavaScript & HTML5 apps, packaged as native apps for iPhone and Android. We use PhoneGap (mentioned above), with an added drag-and-drop interface, enabling you to make your own apps.
You can use phonegap as a javascript, html and css wrapper in your ios app if you want to create a native app using html and javascript.
There's NimbleKit which allows you to make native apps using HTML and Javascript. Otherwise you can use a UIWebview which you can execute Javascript in. Look at the UIWebView documentation for more info.
There are tools to code your app in javascript and compile it into native code.
But if you want your app to load javascript code at runtime and run it, then see this for more details.

Is there a platform that bundles HTML5, CSS3 and JavaScript into a native mobile app?

Is there a platform I can use that takes all the technologies mentioned in the title and packages a native application for the most popular mobile Operating Systems (Android, iOS, RIM, WP7 etc)?
Thank you.
Yep, its called PhoneGap. PhoneGap Home
The first option requires you to build a file in an IDE. The second option they have is to upload a zip file in a certain format and they do the IDE work: PhoneGap Build
I have used both. They are quite fun to use! Read the APIs, the application is a little different in build structure than a typical web application.
Yes, you can use a software like Appcelerator Titanium to build applications for multiple platforms.
You can learn more at http://www.appcelerator.com
If you're not going to use any of the native libraries each of the platform provides, you're better off providing a mobile web site and instructing your users to bookmark it (you can bookmark pages to the homescreen in most of those platforms). Much less intrusive, much more simpler and maintainable.
Depending on what you want to do, yes - PhoneGap and Titanium Appcelerator are particularly suitable for this.
Someone I follow on Twitter did a nice write of comparing Appcelerator VS. PhoneGap VS. Adobe Air:
http://savagelook.com/blog/portfolio/appcelerator-vs-phonegap-vs-adobe-air
I've only used PhoneGap and dabbled briefly with Appcelerator. I found that PhoneGap used to be better, but that may no longer be the case it seems.
You could try and check out http://jquerymobile.com/

Javascript app in Android

I am new to Android programming, and looking for some general knowledge. I am considering writing logic of my application in javascript so that the same code could be executed in a webapp and in a desktop application. Would it be possible to also have it working on Android? I know that:
SL4A is marked as alpha-quality, and user would need to install it to make such an app work. Still it provides access to Android API. SL4A scripts also cannot go to Android Market, as far as I know.
A simple webapp doesn't have access to most Android API.
Would it be possible to write a simple Java app that would embed an HTML widget with javascript code and provide some wrapper to access necessary API?
I am not looking for a fully portable thing--I intend to adapt UI to each environment manually. I just would like to have the internal logic common to all ports.
PhoneGap allows you to write an HTML-based app that not only works with Android, but also iPhone, Windows Phone 7, WebOS and more. The API is standardized, so you can use the same page on all the platforms.
There's support for the most common native features on most platforms. (Here's a chart of the features supported on each platform) In addition, if you find that there's a feature you cannot replicate using only their API, you can write a plugin in the native platform language (so, for Android that'd be Java), and then call that plugin from your HTML/Javascript-page.
If you want to use javascript and access the native api then you should try Appcelerator.com. Those people are providing this.
There is Rhino, which is a Javascript engine written in Java. It works in Android, and it is used by Appcelerator's Titanium mentioned in another answer here.
User interface and Android-specific API can then be written and wrapped in Java, then called by the logic code written in Javascript and run by Rhino.
Consider GWT, a Java to javaScript compiler. You can write your logic and a lot of other code in plain old Java(There are a few things(e.g. reflection) that you can't do like reflection but you wouldn't be able to do it in javaScipt either) Applications like Google inbox are using GWT to reuse a lot of their code in javaScript. They don't just reuse logic either. You can reuse dependency injection, your architecture, AJAX calls and more. Also, GWT is faster than javaScript in both the browser and the JVM. The biggest problem you might have with GWT is that it's more complicated javaScript. Regular Java is already more complicated. Making it work on both the JVM and browser can only make things more complicated. Also, GWT was designed from the ground up for extremely complciated web apps.

Developing Windows apps with JavaScript

I'm currently in the need of developing a Windows application. I want to keep things simple (in the spirit of uTorrent) and I would like the result program to be a single .exe file containing all that it needs.
The program is simple. It just needs some UI. It needs to run for a long period of time (lay there as a tray icon). It needs to do some routine tasks like simple I/O. It also needs to access the internet, specifically some web server.
Apart from these small requirements I would like to write all of it in JavaScript, as I feel more comfortable with it than any other language.
I know there's things like Windows Script Host that let you run JavaScript programs and interact with some Win32 API, but will I be able to do everything I need with Windows Script Host? Can I pack all of the Windows Script Host in a single .exe?
If not, what alternatives do I have for JavaScript?
I found that there's actually a JavaScript compiler that comes with the .NET framework called jsc.exe.
For more information:
http://www.phpied.com/make-your-javascript-a-windows-exe/
http://msdn.microsoft.com/en-us/library/7435xtz6(VS.80).aspx
I guess it's not really JavaScript since it introduces extra things like import and even some class syntax which is weird for me. But this works perfectly for me as I will just doing things as I am used to on the web.
Aside from Windows Script Host, there are
Windows Desktop Gadgets (Vista and Windows 7 only)
HTML Applications (HTAs)
Both are written with standard web technologies, HTML, JavaScript, Flash, etc. They can also be extended with COM objects/ActiveX controls such as FileSystemObject, WMI, WScript or even ones that you write yourself. Windows Desktop Gadgets have access to a separate API/namespace with various Win32-esque properties and methods.
It seems that nobody mentioned JSDB.
JSDB offers a command line environment which you can execute arbitrary javascript code. You can easily compile to a .exe file by using the command copy /b jsdb.exe+program.zip program.exe
It's important to know that you've got to call your main js file main.js within a standard zip file. Not sure if the name program.zip is required.
I haven't actually tried making GUI applications with this yet - although it seems to support various APIs like ActiveX.
It's possible that by using the copy /b command mentioned above, you could compile a script from the wscript.exe file - but I tried and couldn't get it working. Let me know if anybody tries and has success somehow.
I think you're looking for Adobe AIR
The Adobe® AIR® 2 runtime enables developers to use HTML, JavaScript, Adobe Flash® software, and ActionScript® to build web applications that run as standalone client applications without the constraints of a browser. ~ The AIR website
Internet Explorer introduced the concept of Hypertext Applications in IE 5. It never made a big breakthrough, so resources and documentation are scarce.
Mozilla-backed competitor Prism seems to be alive and well, though, and is definitely worth a look.
Prism is an application that lets users split web applications
out of their browser and run them directly on their desktop
I believe the best way to go is V8 JavaScript Engine provided by Google.
"V8 can run standalone, or can be embedded into any C++ application." - which I believe is perfect for your needs, because you can do most of the stuff in JavaScript and use provided interfaces to communicate with the system.
I'm not 100% but I believe WSH uses JScript or WScript, not JavaScript.
Color me crazy, but its only a short step form Javascript to Java or C#. I'd suggest C# as, on a windows machine, the libraries are already there. You can just copypaste your .exe and let 'er rip.
If you want a single .EXE, what runtimes are you okay if they are required pre-requisites?
If you're okay with requiring .NET runtime to be preinstalled, then you do all your work in JScript.NET
Chromium Embedded Framework (CEF) may give you some help. i have not clearly know how, but i realy found many Apps using this framework.
http://code.google.com/p/chromiumembedded/
Introduce for CEF are:
The Chromium Embedded Framework (CEF) is an open source project founded by Marshall Greenblatt in 2008 to develop a Web browser control based on the Google Chromium project. CEF currently supports a range of programming languages and operating systems and can be easily integrated into both new and existing applications. It was designed from the ground up with both performance and ease of use in mind. The base framework includes C and C++ programming interfaces exposed via native libraries that insulate the host application from Chromium and WebKit implementation details. It provides close integration between the browser control and the host application including support for custom plugins, protocols, JavaScript objects and JavaScript extensions. The host application can optionally control resource loading, navigation, context menus, printing and more, while taking advantage of the same performance and HTML5 technologies available in the Google Chrome Web browser.
Numerous individuals and organizations contribute time and resources to support CEF development, but more involvement from the community is always welcome. This includes support for both the core CEF project and external projects that integrate CEF with additional programming languages and frameworks (see the "External Projects" section below).
Why not use Rhino -- JavaScript on the JVM? You can even compile your scripts to .class files and package them into a JAR along with Rhino for easy distribution...

Categories

Resources