-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate sample from GCM to FCM #87
Conversation
@@ -123,17 +122,17 @@ private void createCameraSource(boolean autoFocus, boolean useFlash) { | |||
.setFacing(CameraSource.CAMERA_FACING_BACK) | |||
.setRequestedPreviewSize(1024, 600) | |||
.setRequestedFps(15.0f) | |||
.setFocusMode(autoFocus ? Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE : null); | |||
.setFocusMode(true ? Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE : null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove the conditionals.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Left this to linter auto-fix.
@@ -63,21 +63,23 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginBottom="12dp" | |||
android:textIsSelectable="true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only affects the sample app. It makes the text selectable so one can easily copy the device name / fcm token and use it on the firebase console to send test fcm notifications . No cosmetic change.
@@ -224,12 +224,12 @@ private String createJWT(@NonNull PrivateKey privateKey, | |||
String headerAndPayload = base64UrlSafeEncode(gson.toJson(headers).getBytes()) | |||
+ "." + base64UrlSafeEncode(gson.toJson(claims).getBytes()); | |||
final byte[] messageBytes = headerAndPayload.getBytes(); | |||
final Signature signer = Signature.getInstance("SHA256withRSA", "BC"); | |||
final Signature signer = Signature.getInstance("SHA256withRSA"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caused by: java.security.NoSuchAlgorithmException: The BC provider no longer provides an implementation for Signature.SHA256withRSA.
Please see https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html for more details.
Followed this migration guide.
GcmListenerService
-> https://developers.google.com/cloud-messaging/android/android-migrate-gcmlistenerIDListenerService
-> https://developers.google.com/cloud-messaging/android/android-migrate-iid-serviceapp/README.md
file adding instructions on what values need to be set for this sample app to work. To sum up, thegoogle-services.json
file that can be downloaded from the Firebase console when opening the project configuration view, and the Guardian URL (same as before).Sample app won't run unless a valid
google-services.json
file is present on the app's module root.