1

我已经使用 PhoneGap Build 构建了一个应用程序,并希望进行以下修改。

在设备上首次启动或更新后首次启动时,我希望有一个屏幕显示条款和条件(可能还有一个输入电子邮件地址的字段)。在屏幕底部,会有一个 Accept 或 Decline,之后用户将进入或退出应用程序。应该存储答案(可能使用“文件”API:http ://api.phonegap.com/1.0/file ?)

在后续加载时,应用程序应首先检查使用“文件”API 存储的数据,以查看之前是否已接受条款。如果是这样,用户应该在没有任何提示的情况下进入应用程序。如果没有,用户应再次收到条款和条件的提示。

4

1 回答 1

2

You sound like you are on the right track. Just make sure you are using the right documentation for the version of phonegap you are using. The one you linked above is for version 1.0...

First, you want to use the local storage API, not the file API. Assuming you are using Phonegap Build 3.0 you can find the documentation here.

Next, every time your index.html page loads, you want to check the local storage to see if they have agreed to your terms and what version of the apps terms they agreed to.

tx.executeSql('Select agreedBool FROM termsTable WHERE version = "1.0.0"', [], successFunction, errorFunction);

If agreedBool = true, do nothing. If agreedBool = false, then show your terms pop-up or transfer them to your terms.html page or however you want to show it. When then they click agree, save that value to the database and close your pop-up or redirect back to index.html.

tx.executeSql('INSERT INTO termsTable (agreedBool, version) VALUES (true, "1.0.0")');

As for the user choosing not to agree to the terms, I wouldnt give them an agree and disagree button. Only give them an agree button. If they dont agree, then they can close your app themselves.

于 2013-10-03T11:29:50.963 回答