Cordova Background Geolocation 示例应用教程
1. 项目的目录结构及介绍
cordova-background-geolocation-SampleApp/
├── bin/
├── resources/
├── scripts/
├── src/
├── .gitignore
├── LICENSE.md
├── README.md
├── angular.json
├── config.xml
├── ionic.config.json
├── karma.conf.js
├── package-lock.json
├── package.json
├── tsconfig.app.json
├── tsconfig.json
└── tsconfig.spec.json
bin/
: 包含一些构建和运行脚本的目录。resources/
: 包含应用的资源文件,如图标和启动画面。scripts/
: 包含一些自定义脚本。src/
: 包含应用的主要源代码。.gitignore
: Git忽略文件。LICENSE.md
: 项目的许可证文件。README.md
: 项目的说明文档。angular.json
: Angular项目的配置文件。config.xml
: Cordova项目的配置文件。ionic.config.json
: Ionic项目的配置文件。karma.conf.js
: Karma测试框架的配置文件。package-lock.json
: npm依赖锁文件。package.json
: npm包配置文件。tsconfig.app.json
: TypeScript应用配置文件。tsconfig.json
: TypeScript主配置文件。tsconfig.spec.json
: TypeScript测试配置文件。
2. 项目的启动文件介绍
项目的启动文件位于 src/
目录下,主要包括:
main.ts
: 应用的主入口文件,负责启动Angular应用。index.html
: 应用的HTML模板文件,包含应用的根元素。app.component.ts
: 应用的根组件,负责初始化应用的视图和逻辑。
3. 项目的配置文件介绍
config.xml
config.xml
是Cordova项目的配置文件,包含应用的基本信息、插件配置、平台配置等。
<widget id="com.transistorsoft.backgroundgeolocation.ionic2" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>BG Geo</name>
<description>A sample Apache Cordova application that responds to the deviceready event.</description>
<author email="support@transistorsoft.com" href="http://transistorsoft.com">Transistor Software</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
package.json
package.json
是npm包配置文件,包含项目的依赖、脚本、版本等信息。
{
"name": "cordova-background-geolocation-SampleApp",
"version": "0.0.1",
"author": "Chris Scott <chris@transistorsoft.com>",
"homepage": "https://transistorsoft.com",
"private": true,
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"dependencies": {
"@angular/common": "~8.1.2",
"@angular/core": "~8.1.2",
"@angular/forms": "~8.1.2",
"@angular/platform-browser": "~8.1.2",
"@
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考