Joke Collection Website - Blessing messages - How to package an ios-based webapp with phonegap
How to package an ios-based webapp with phonegap
1、phonegap
This jar file contains the DroidGap class, which properly encapsulates Activity and WebView, making it easier for users to package.
The more important function is to implement multiple Webkit plug-ins, through which some system functions of android can be directly called in javascript, such as obtaining device information such as screen size and system version number, and a series of functions such as making phone calls, sending text messages and writing local files.
2、phonegap
This js file is encapsulated at a higher level, so it is more convenient to call the added plug-in function in javascript. For example, call directly in js:
A navigator. Notice. Vibration (0) can directly make the mobile phone vibrate.
And navigator.notification.Beep(2) can make the phone ring twice.
Let's try the simplest example (you can also see the example that comes with phonegap):
(1)java source code file: Sample.java.
Parcel? com . phonegap . sample; ? Import? Android . app . activity; ? Import? Android . OS . bundle; ? Import? com . phonegap . *; ? Public? Class? Sample? Extension? DroidGap? { ? @ Overwrite? Public? Invalid? OnCreate (bundle? savedInstanceState)? { ? super . oncreate(savedInstanceState); ? super . loadurl(" file:///Android _ asset/www/index . html "); ? } ? }
(2) Web page code: index.html
& lt! DOCTYPE? html & gt? & lthtml & gt? & lthead & gt? & ltmeta? http-equiv="Content-Type "? content = " text/html; ? Charset=utf-8 ">& lt script? type="text/javascript "? charset="utf-8 "? src="phonegap.0.9.4.js " >& lt/script & gt; ? < title > test ; ? & lt/head & gt; ? & ltbody & gt? & lt answer? href = " JavaScript:navigator . notification . alert(' hello ');" & gt click? I & lt/a & gt;; ? & lt/body & gt; ? & lt/html & gt;
Put this file in the assets/www/ directory of the project, and if the webpage code contains other directories, put it in this directory.
(3) Add a reference to phonegap.0.9.4.jar in the project.
When compiling and running, click the click me link in the page to see the following screen:
- Related articles
- Which bank loans don't look at personal credit information?
- Can I check the net value of "Oriental Pearl" overseas wealth management product (code 830002) through ICBC SMS Bank?
- Excuse me, how does vivo's mobile phone export all the information in the mobile phone to the computer? Thank you.
- How to report a scam call?
- Baoyan contacted her tutor. How can the tutor reply to be successful?
- Good morning, welcome to call 9- 12.
- Excuse me, what does Shanghai Telecom's flow card contain?
- How about red rice note eight? Set the point reading mode.
- How to send New Year greetings to people you like?
- Husband celebrates his ex-girlfriend's birthday. What should I do?