In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you what PhoneGap applications are like. The content is concise and easy to understand. It will definitely make your eyes shine. I hope you can gain something from the detailed introduction of this article.
PhoneGap is an app development platform that makes it easy to call native APIs and publish apps to stores using HTML5. The official said that there are advantages such as low cost, low development cycle, lightweight, etc., which we cannot prove for the time being, so we skip the table. But there is a cross-platform, but it is a very obvious advantage. Because it uses HTML5+JavaScript to develop applications. PhoneGap uses JavaScript to encapsulate native APIs of several major platforms (Andriod, IOS, WP8/7, WINRT) and so on. In this case, porting from one platform to another only requires taking the HTML code and JS intact and packaging it. PhoneGap was later acquired by Adobe, then contributed to the open source community, and is now managed by Apache under the name cordova.
To port yesterday's html5 tablet to mobile devices, I decided to use phoneGap, so that I could write one side and run more.
Today, we'll set up the phoneGap environment under Andriod.
1. Download phoneGap
http://phonegap.com/download/#autodownload
Unzip it and find the lib/android directory.
2. Create a new Andriod project under eclipse, which is the same as a normal project.
3. Create a new folder "www" under assets directory
Copy cordova-2.6.0.js from lib/android to this directory. Copy cordova-2.6.0.jar to the libs directory.
4. Create a new html file index.html in the www directory. Our interface is going to be built here.
The index code is as follows:
The code is as follows:
HTML5Paint
alert("HELLO CORDOVA");
HTML5Paint
5. Copy the xml folder under lib/android directory to res
6. Modify AndroidManifest.xml Add user permissions
Add the following code to the front of the label
The code is as follows:
7. Modify MainAcivity.java
The code is as follows:
public class MainActivity extends DroidGap {
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
8.There will be an error when building, this is because the cordova-2.6.0.jar was not added to the buildpath. Add buildpath.
Keep building and it's over.
The final run:
A phonegap Andriod program is done. Tomorrow I will transplant yesterday's HTML5 artboard.
That's how PhoneGap works. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.