-1

I have copied and modified a barcode reader from google to fit my own needs. It works perfectly as an android app.

PhoneGap allows to load android apps from Javascript, how can I load my complete application when for example pressing a button in my index.html.

There is certainly an easy way of importing the application otherwise the concept would not make much sense. Can someone please tell me how to do it or link me a good tutorial?

I use this code from google (multi tracker): https://github.com/googlesamples/android-vision

1 Answers1

0
  1. PhoneGap does not allow you to load android apps.
  2. PhoneGap does not 'import' your app.
  3. You misunderstand the technologies involved.

PhoneGap wraps your app inside a special container that will be recognised by Apple, Android or Windows.

The PhoneGap website should help you get started http://docs.phonegap.com/

  • Thanks for your reply. Before I start reading the docs: Is it anyway possible without to much re-coding to 'start' my finished application via PhoneGap? I basically want to create a nice front-end using html/css/javascript and if I press a button, it just loads an activity in my android app (and everything else that is necessary for this activity) that I can use as long as I achieve a certain result there. – user3649938 Mar 27 '16 at 20:14
  • If you have an app at this moment, where you click on an index page and it offers you your magic button to click, and when you click the magic button, it sings and dances whatever you want it to do, then you have done everything you need to do. Make sure the index.html file is in the root directory, make sure all other html, js, css, images are in a subdirectory and zip everything up. Register and upload your zip file to http://build.phonegap.com - It will allow you to build one app for free ready for installing on an android, apple or windows phone. –  Mar 27 '16 at 20:22
  • An alternative avenue is http://docs.phonegap.com/getting-started/2-install-mobile-app/ however based on the little reading I have from you above, it sounds like you are less technical, or lazy and cutting corners. Running before you can walk will only lead to tripping up and much pain. We have all had to learn, there is no shame to it. Walk, don't run. –  Mar 27 '16 at 20:27
  • I need to create and app that is not only running on a specific platform, so my teacher thinks that PhoneGap is a good way to realize that. I googled a bit and thought that I could basically create an android app and use it on every device with the help of PhoneGap. If that is not possible/ I have to rewrite everything (which I cannot, because the code is a few thousand lines long and comes from google) than I simply have to change my topic as it may go faaaar beyond what I was expecting... – user3649938 Mar 27 '16 at 20:36
  • Re-read what I said above. Do you already have a web page with a button for you to click on? And when you click on this button, does it do whatever you want it to do? If the answer is yes, then you can package it into PhoneGap. If the answer is no, then you have to learn how to code before you can package. –  Mar 27 '16 at 20:40
  • I think you misunderstood me now, or I was not clear before. Yes, I have a webpage with a button but no, it does not trigger what it should. It should start an activity or basically be the entry point to a finished android app that scans barcodes. Apparently it is not possible to write just a "few" lines of code to "connect" front-end and android-app back-end, right? I need to rewrite everything, or write a complex plugin. – user3649938 Mar 27 '16 at 20:45
  • First line in your OP says *I have copied and modified a barcode reader from google to fit my own needs. It works perfectly as an android app.* So.... When you say "it works perfectly as an android app" I guess you did not mean it works perfectly? Yes, you need to code - It is probably not as difficult as you think since you already have some code produced from google, but if you have no idea of what a javascript function or javascript variable is, then your task is bigger than you might otherwise have imagined. –  Mar 27 '16 at 20:56
  • I works perfectly, but just on my android device (open in android studio, press 'run', it works). What didn't work is a button click on my index.html to start the same app. This 'start' is what I want to achieve using PhoneGap. – user3649938 Mar 27 '16 at 20:59
  • I might be wrong, but.... I believe if you are using Android Studio then your code is native to Android (implying that PhoneGap will not help you). I have clicked on your android-vision google linked and it makes no mention of PhoneGap. It does mention http://stackoverflow.com/questions/tagged/android-vision so i suggest you create a new question on stackoverflow, and ask how you can compile your code using Android Studio to work on an android device. –  Mar 27 '16 at 21:15