Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 8d6decb

Browse files
#74 Added Facebook Login for Android - small tweaks & version bump
1 parent 96eaba0 commit 8d6decb

File tree

5 files changed

+232
-204
lines changed

5 files changed

+232
-204
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
<img src="docs/images/firebase-logo.png" width="116px" height="32px" alt="Firebase"/>
22

3+
## 3.4.3 (2016, July 16)
4+
5+
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.4.2...3.4.3)
6+
7+
### SDK versions
8+
If version numbers changed clean your platform folders to avoid build errors.
9+
10+
- iOS: 3.3.x
11+
- Android: 9.2.0
12+
13+
### New
14+
- [#74](#74) Facebook login for Android.
15+
16+
17+
318
## 3.4.2 (2016, July 14)
419

520
[Full changelog](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/compare/3.4.0...3.4.2)

docs/AUTHENTICATION.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,11 +203,18 @@ Then add the following lines to your code and check for setup instructions for y
203203

204204
#### Android
205205

206-
1. Uncomment the facebook plugin in `node_modules\nativescript-plugin-firebase\platforms\android\include.gradle`
207-
2. Add `<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>` to the manifest/application tag in `app\App_Resources\Android\AndroidManifest.xml`
208-
3. Add `<string name="facebook_app_id">1234</string>` to `platforms\android\src\main\res\values\strings.xml`
209-
4. In your facebook dev console, add the Android app and set the Google Play Packagename to your applicationId (see your `package.config` or in `app\App_Resources\Android\app.gradle`) and the Classname to `com.tns.NativeScriptActivity`.
210-
5. Set the Key-Hash as well. If you don't know it you can also try facebook login in your app and observe the `adb logcat` output for something like `Key hash <......> does not match any stored key hashes.`
206+
1. Uncomment the facebook SDK in `node_modules\nativescript-plugin-firebase\platforms\android\include.gradle`
207+
2. Add `<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>` to the `manifest/application tag` in `app\App_Resources\Android\AndroidManifest.xml`
208+
3. Create a file `app\App_Resources\Android\facebooklogin.xml` and add this (replace the id):
209+
210+
```xml
211+
<?xml version='1.0' encoding='utf-8'?>
212+
<resources>
213+
<string name="facebook_app_id">126035687816994</string>
214+
</resources>
215+
```
216+
4. In your Facebook dev console, go to the Basic settings and add the Android platform if you haven't already. Then set the 'Google Play Packagename' to your applicationId (see your `package.json`) and set 'Classname' to `com.tns.NativeScriptActivity`.
217+
5. Set the Key-Hash as well. If you don't know it you can try Facebook login in your app and observe the `adb logcat` output for something like `Key hash <......> does not match any stored key hashes.`
211218

212219
### logout
213220
Shouldn't be more complicated than:

firebase.android.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,16 @@ firebase.init = function (arg) {
188188
firebase.storage = com.google.firebase.storage.FirebaseStorage.getInstance().getReferenceFromUrl(arg.storageBucket);
189189
}
190190

191+
// Facebook
191192
if (typeof(com.facebook) !== "undefined") {
192193
com.facebook.FacebookSdk.sdkInitialize(appModule.android.context);
193194
fbCallbackManager = com.facebook.CallbackManager.Factory.create();
194195
appModule.android.on("activityResult",function(eventData){
195196
fbCallbackManager.onActivityResult(eventData.requestCode, eventData.resultCode, eventData.intent);
196-
})
197+
});
197198
}
198199

199-
200-
201-
resolve(firebase.instance);
200+
resolve(firebase.instance);
202201
} catch (ex) {
203202
console.log("Error in firebase.init: " + ex);
204203
reject(ex);

0 commit comments

Comments
 (0)