将你的 Facebook 页面作为 Firefox OS 移动应用

尚无读者喜欢这篇文章。
Different cell phones

Opensource.com

无论您是企业还是社区页面的所有者,有什么比通过提供独立的移动应用来提高页面可访问性更好的呢?

Apptuter 是一个开源框架,旨在帮助您实现这一目标,只需最少的编码知识和易于遵循的步骤,您就可以制作自己的应用。该框架目前支持将 Facebook 页面作为内容源,并能够为 Firefox OS、Android 和 IOS 平台生成应用。

工作原理

让我们试驾一下它是如何工作的。在我们的示例中,我们将使用 Mozilla 的 Facebook 页面作为内容源来生成一个独立的应用程序。

克隆仓库

第一步是从 Apptuter 仓库下载或克隆 Apptuter-Firefox 目录

git clone https://github.com/egirna/apptuter.git

目录结构应如下所示

Directory structure

获取 Facebook 数字 ID

然后我们需要获取 Facebook 数字页面 ID。如果您已分配友好的页面名称,则页面 ID 将无法从页面 URL 中看到,在这种情况下,我们需要访问以下 URL 来检索它: https://graph.facebook.com/mypagename

在我们的示例中,这将是: https://graph.facebook.com/mozilla

页面 ID 将在返回数据的第一行可见。

AppPuter Numerical ID

创建 Facebook 应用

下一步是创建 Facebook 应用:您将能够通过组合 APP IDAPP SECRET 来获取应用 ACCESS TOKEN,以便请求的 URL 应采用以下形式
http://graph.facebook.com/endpoint?key=value&access_token=app_id|app_secret

Apptuter Facebook App

请求页面信息 (Info.js) 是我们定义这些参数的地方,将 PageID 替换为可在 /Apptuter-Firefox/js 中找到的数字

var Main = function () {
    this.pageName = ‘pageID’;
    this.name = null;
    this.category = null;
    this.description = null;
    this.photoArray = null;
    this.postArray = null;
    this.infoArray = [];
    this.accessToken = 'AppID|AppSecret';
    this.pictureUrl = null;
    this.paging = 'https://graph.facebook.com/' + this.pageName + '/posts?limit=20&access_token='+this.accessToken;
    this.pagingNext = 'https://graph.facebook.com/' + this.pageName + '/posts?limit=20&access_token='+this.accessToken;
}

让我们在目录根目录下的 manifest.webapp 文件中定义新的应用程序属性

{
  "name": "Mozilla App",
  "description": "This is an example app of apptuter framework",
  "launch_path": "/Shared/index.html",
  "icons": {
    "32": "/images/app_icon_32.png",
    "60": "/images/app_icon_60.png",
    "90": "/images/app_icon_90.png",
    "120": "/images/app_icon_120.png",
    "128": "/images/app_icon_128.png",
    "256": "/images/app_icon_256.png"
  },
  "chrome": {
    "navigation": true
  },
  "version": "1.0.1",
  "developer": {
    "name": "Egirna Technologies Limited",
    "url": "http://www.apptuter.org"
  },
  "orientation": [
    "portrait"
  ],
  "default_locale": "en"
}

美术素材

剩下的唯一事情是美术素材。从仓库中,转到 /Apptuter-Firefox/images,并将默认图像替换为我们示例徽标的图像,确保尺寸和文件名匹配。

App icons

成功!

我们完成了!让我们使用 Firefox OS 模拟器测试一下应用程序的外观

Apptuter Facebook Firefox OS App 1

Apptuter Facebook Firefox OS App 2

Apptuter Facebook Firefox OS App 3

您最终有责任在使用本软件时遵守 Facebook、Google 和 Mozilla 的服务条款以及最终用户许可协议。这适用于本软件可能与之集成的任何服务。

最初发布于 Mozilla Hacks。在 Creative Commons 许可下转载。

User profile image.
Zeinab Abdelgawad | Egirna Technologies 的业务发展主管。对营销和新技术感兴趣。

评论已关闭。

Creative Commons License本作品根据 Creative Commons 署名-相同方式共享 4.0 国际许可协议获得许可。
© . All rights reserved.