You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+87-101
Original file line number
Diff line number
Diff line change
@@ -6,146 +6,106 @@ The Facebook plugin for [Apache Cordova](http://incubator.apache.org/cordova/) a
6
6
7
7
* Supported on PhoneGap (Cordova) v3.3.0 and above.
8
8
* This plugin is built for
9
-
* iOS FacebookSDK 3.13.0
10
-
* Android FacebookSDK 3.8.0
9
+
* iOS FacebookSDK 3.16.1
10
+
* Android FacebookSDK 3.16.0
11
11
12
12
## Facebook Requirements and Set-Up
13
13
14
-
The Facebook SDK (both native and JavaScript) is changing independent of this plugin. The manual install instructions include how to get the latest SDK for use in your project.
14
+
To use this plugin you will need to make sure you've registered your Facebook app with Facebook and have an `APP_ID`[https://developers.facebook.com/apps](https://developers.facebook.com/apps).
15
15
16
-
To use this plugin you will need to make sure you've registered your Facebook app with Facebook and have an APP_ID (https://developers.facebook.com/apps).
16
+
#### Install Guides
17
17
18
-
#### iOS
19
-
If you plan on rolling this out on iOS, please note that you will need to ensure that you have properly set up your Native iOS App settings on the [Facebook App Dashboard](http://developers.facebook.com/apps). Please see the [Getting Started with the Facebook SDK](https://developers.facebook.com/docs/ios/getting-started/): Create a Facebook App section, for more details on this.
18
+
-[iOS Guide](platforms/ios/README.md)
20
19
21
-
#### Android
22
-
If you plan on rolling this out on Android, please note that you will need to [generate a hash of your Android key(s) and submit those to the Developers page on Facebook](https://developers.facebook.com/docs/android/getting-started/facebook-sdk-for-android/) to get it working. Furthermore, if you are generating this hash on Windows (specifically 64 bit versions), please use version 0.9.8e or 0.9.8d of [OpenSSL for Windows](http://code.google.com/p/openssl-for-windows/downloads/list) and *not* 0.9.8k. Big ups to [fernandomatos](http://github.com/fernandomatos) for pointing this out!
20
+
-[Android Guide](platforms/android/README.md)
23
21
24
-
#### Web App
25
-
`www/js/facebookConnectPlugin.js` contains the JavaScript SDK and API file. The API matches as close as possible to the native APIs.
22
+
-[Web App Guide](platforms/web/README.md)
26
23
27
-
## Example Apps
24
+
####Example Apps
28
25
29
26
`platforms/android` and `platforms/ios` contain example projects and all the native code for the plugin for both Android and iOS platforms. They also include versions of the Android and iOS Facebook SDKs. These are used during automatic installation.
30
27
31
-
#### Setup Android Example
32
-
33
-
Configure the project with your FB app id in the `res/values/facebookconnect.xml` file. For example:
34
-
35
-
```xml
36
-
<resources>
37
-
<stringname="fb_app_id">123456789</string>
38
-
<stringname="fb_app_name">TEST</string>
39
-
</resources>
40
-
```
41
-
42
-
#### Setup iOS Example
43
-
44
-
- Change **FacebookAppID** in project *-info.plist
45
-
- Change URL scheme to `fb<YOUR APPID>` e.g. `fb123456789`
46
-
47
-
#### Setup Web App Example
48
-
49
-
Host the `www` folder on a server and configure your Facebook dashboard correctly to test the Web APIs. Most people use [Parse](https://parse.com/) for easy testing.
50
-
51
-
52
-
## Adobe PhoneGap Build
28
+
#### Adobe PhoneGap Build
53
29
54
30
If using this plugin on Adobe PhoneGap Build you can ignore the instructions below and go straight to the
55
31
PhoneGap Build documentation available [here] (https://build.phonegap.com/plugins/257).
56
32
57
-
## Manual Installation
58
-
59
-
- None! CLI automatic install is now the recommended method.
60
-
- Why?
61
-
- Too much can go wrong with this plugin for manual installs.
62
-
- We automate so you have less work to do!
63
-
- All Plugins should be CLI compatible since Cordova 3
64
-
65
-
## Automatic Installation
66
-
67
-
This plugin is based on [plugman](https://git-wip-us.apache.org/repos/asf?p=cordova-plugman.git;a=summary).
68
-
69
-
It will:
70
-
71
-
- add native class files
72
-
- setup the whitelist
73
-
- setup URL scheme (for deeplink with FB application if installed)
74
-
- and add your Facebook application Id automagically to a string resource file that can be read from the plugin.
33
+
## API
75
34
76
-
To install the plugin in your app, execute the following (replace variables where necessary)...
**Android requires an additional step which is to reference the FacebookSDK project as a library to your project.**
51
+
### Logout
100
52
101
-
Open your project in Eclipse (New > Project... Existing Android project from source), import everything (***see Img. 1***).
53
+
`facebookConnectPlugin.logout(Function success, Function failure)`
102
54
103
-
***Img. 1***
55
+
### Get Status
104
56
105
-
In Eclipse, right click your project folder in the left-had column. Select "Properties", select Android in the left column and in the right side of the window add FacebookSDK as a library (***see Img. 2***).
57
+
`facebookConnectPlugin.getLoginStatus(Function success, Function failure)`
106
58
107
-
***Img. 2***
59
+
Success function returns a status Object. Example:
`facebookConnectPlugin.api(String requestPath, Array permissions, Function success, Function failure)`
143
103
144
104
Allows access to the Facebook Graph API. This API allows for additional permission because, unlike login, the Graph API can accept multiple permissions.
145
105
146
106
Example permissions:
147
107
148
-
["basic_info", "user_birthday"]
108
+
["public_info", "user_birthday"]
149
109
150
110
Success function returns an Object.
151
111
@@ -159,7 +119,33 @@ For more information see:
159
119
- Graph Explorer - [https://developers.facebook.com/tools/explorer](https://developers.facebook.com/tools/explorer)
160
120
- Graph API - [https://developers.facebook.com/docs/graph-api/](https://developers.facebook.com/docs/graph-api/)
161
121
162
-
## Sample JavaScript Code
122
+
# Events
123
+
124
+
App events allow you to understand the makeup of users engaging with your app, measure the performance of your Facebook mobile app ads, and reach specific sets of your users with Facebook mobile app ads.
-[JS] Does not have an Events API, so the plugin functions are empty and will return an automatic success
129
+
130
+
Activation events are automatically tracked for you in the plugin.
131
+
132
+
Events are listed on the [insights page](https://www.facebook.com/insights/)
133
+
134
+
### Log an Event
135
+
136
+
`logEvent(String name, Object params, Number valueToSum, Function success, Function failure)`
137
+
138
+
-**name**, name of the event
139
+
-**params**, extra data to log with the event (is optional)
140
+
-**valueToSum**, a property which is an arbitrary number that can represent any value (e.g., a price or a quantity). When reported, all of the valueToSum properties will be summed together. For example, if 10 people each purchased one item that cost $10 (and passed in valueToSum) then they would be summed to report a number of $100. (is optional)
141
+
142
+
### Log a Purchase
143
+
144
+
`logPurchase(Number value, String currency, Function success, Function failure)`
145
+
146
+
**NOTE:** Both parameters are required. The currency specification is expected to be an [ISO 4217 currency code](http://en.wikipedia.org/wiki/ISO_4217)
147
+
148
+
## Sample Code
163
149
164
150
### Login
165
151
@@ -169,12 +155,12 @@ In your `onDeviceReady` event add the following
169
155
alert("UserInfo: " + JSON.stringify(userData));
170
156
}
171
157
172
-
facebookConnectPlugin.login(["basic_info"],
158
+
facebookConnectPlugin.login(["public_info"],
173
159
fbLoginSuccess,
174
160
function (error) { alert("" + error) }
175
161
);
176
162
177
-
### Get access token
163
+
### Get Access Token
178
164
179
165
If you need the Facebook access token (for example, for validating the login on server side), do:
180
166
@@ -187,12 +173,12 @@ If you need the Facebook access token (for example, for validating the login on
187
173
});
188
174
}
189
175
190
-
facebookConnectPlugin.login(["basic_info"],
176
+
facebookConnectPlugin.login(["public_info"],
191
177
fbLoginSuccess,
192
178
function (error) { alert("" + error) }
193
179
);
194
180
195
-
### Get Status & Post-to-wall
181
+
### Get Status and Post-to-wall
196
182
197
183
For a more instructive example change the above `fbLoginSuccess` to;
198
184
@@ -213,7 +199,7 @@ For a more instructive example change the above `fbLoginSuccess` to;
213
199
);
214
200
};
215
201
216
-
### Getting A User's Birthday
202
+
### Getting a User's Birthday
217
203
218
204
Using the graph api this is a very simple task: [currently iOS only!]
0 commit comments