Skip to content

Commit f15e9a9

Browse files
authored
Update GoogleFirebaseConsoleSetup.md
1 parent 4c802a4 commit f15e9a9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/GoogleFirebaseConsoleSetup.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,26 @@ keytool -list -v -keystore /Users/[USERNAME]/.local/share/Xamarin/Mono\ for\ And
4242
keytool -list -v -keystore "C:\Users\[USERNAME]\AppData\Local\Xamarin\Mono for Android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
4343

4444
```
45+
Other alternative is to adding this method and calling it on the MainActivity OnCreate method to get the SHA 1 printed on the application output:
46+
47+
```cs
48+
public static void PrintHashKey (Context pContext)
49+
{
50+
try {
51+
PackageInfo info = Android.App.Application.Context.PackageManager.GetPackageInfo (Android.App.Application.Context.PackageName, PackageInfoFlags.Signatures);
52+
foreach (var signature in info.Signatures) {
53+
MessageDigest md = MessageDigest.GetInstance ("SHA");
54+
md.Update (signature.ToByteArray ());
55+
56+
System.Diagnostics.Debug.WriteLine (BitConverter.ToString(md.Digest ()).Replace ("-", ":"));
57+
}
58+
} catch (NoSuchAlgorithmException e) {
59+
System.Diagnostics.Debug.WriteLine (e);
60+
} catch (Exception e) {
61+
System.Diagnostics.Debug.WriteLine (e);
62+
}
63+
}
64+
```
4565

4666
**4.** Finally, you will be able to download the **google-services.json** file and add it to your **Xamarin.Android** project. Make sure build action is GoogleServicesJson
4767

0 commit comments

Comments
 (0)