I am working on the debug version of an android app. I was able to send both SMS and email invites until I recently installed a different OS on my machine (both Linux). As a result, I also updated Android Studio to the latest version, and imported my old project settings. The rest of the application works fine, I can also start the activity for selecting invites, it displays the message that Invitation was sent, but AppInviteInvitation.getInvitationIds returns 0 length array in onActivityResult.
I tried to add Sha1 and Sha256 to the app in the Firebase console, removed Firebase completely and then added it back to the android project in Android Studio (also removed and added again application and project in the firebase console). So checked and tried most of the solutions on SO, but none seems to work. I am probably omitting something. I am using two google accounts, one for firebase, one for email sending from device.
What else could I verify? Is there any way to dig deeper in Firebase invites in order to find the issue?
The intent:
private void onInviteClicked() {
Intent intent = new AppInviteInvitation.IntentBuilder("MyApp")
.setMessage("Some message of 90 nospecial chars")
// .setDeepLink(createDynamicLink(2))
.setCustomImage(Uri.parse("http://correct url"))
.setCallToActionText("Call to action")
.build();
startActivityForResult(intent, REQUEST_INVITE);
}
Short: keep message short (tested with < 40 chars)
Long: My intent actually contained a 90 character message (no special chars), which was sent just fine before the update. After the update, I need to reduce the length of the message (tested with ~40 characters, none is special), in order for it to be sent.
I wonder what determined this behavior. Things that were changed: java (previously was oracle jdk, now it is the java that comes by default with Android Studio); Maybe also java version. Build tools version 25.0.2 -> 26.0.0.
Related
I am trying to integrate FCM notification in my project. I have Cloud Function backend, and app runs on android.
Below is cloud code to send notification:
exports.notificationTest = functions.database.ref(`/test/childA/childB/status`).onUpdate(event => {
const status = event.data.val();
console.info("Processing notificationTest cloud function")
console.info(`status : ${status}`)
const token = "EnterYourNotificationTokenHere"
const randomNum = Math.floor(Math.random() * 100)
var message = {
notification: { title : "My App", body : `Notification Test ${randomNum}`}
}
console.info(`Sending message on notification token`)
return admin.messaging().sendToDevice(token, message)
.then((response) => {
console.info("Successfully sent notification")
}).catch(function(error) {
console.warn("Error sending notification " , error)
})
})
On native Android app, I receive notification multiple times with interval of few mins.
Here, I have seen notification like this:
Notification Test 30
then after 2,4,8,16,32 mins of previous notification time I again get below message
Notification Test 30
I don't think I need to paste log here, because code is definitely executed just once (as the random number in notification stays the same).
So, why is this happening and how to fix it?
Below is my environment:
Native Android App
Using Android 7
Latest Android Studio Stable
Android Gradle Plugin - 3.1.1
Gradle - 4.1
Firebase-Ui - 3.1.0
Play Services - 11.4.2
Please try to reproduce in environment mentioned above.
I have resolved the issue by renaming my application package name
eg old name: com.xyz to com.xyz2
Using the new name i added this (new) android app to firebase project (it generated new app id). And the notifications started worked as expected (no retry).
But its a shame that I have to rename app package to resolve it. If this app was released in google play then I could not have renamed the app, else no one can get further updates on this app, and it becomes a new app!
It would still be great if some firebase developers could shed light on what is happening.
Recreating firebase project and recreating android project did not help when app name / top level package name were the same. Changing app name and relevant namespaces in existing android project fixed it for now.
Ideally I would like to know the proper fix for this and use the existing name rather than suffixing 2 at the end of app name.
I just had this same issue occur with my Ionic Android app. The same notification repeated after 2, 4, and 8 minutes. This seems to be an issue on the client side because it even happens when sending a message directly from the Firebase console.
I tried several things to fix it and it seems like the only way I could get it to work as intended was to make a new Android project and new Firebase app.
I have an app working and published in the Apple's app store. We are developing an update with new features and I noticed that the NotificationsRegistrationHandler is not being called anymore on iOS when the user accepts to receive notification (in Android is working fine). Which means the application is not getting the "DeviceToken", so we are unable to send notification. The proc. is very simple, and doesn't look like the issue because it's working for Android devices:
for each
where DeviceType = &DeviceType // enum domain SmartDeviceType
where DeviceId = &DeviceId // Character(128)
DeviceToken = &DeviceToken // Character(255)
DeviceName = &DeviceName // Character(128)
when none
new
DeviceType = &DeviceType
DeviceId = &DeviceId
DeviceToken = &DeviceToken
DeviceName = &DeviceName
endnew
endfor
What I have tried so far:
Generate and install new distribuition certificates and provision profiles.
Rebuild All, Build With This Only, etc.
Tested in "TestFlight" also.
Tested in different devices.
The published app right now is working, however I fear to publish this upgrade and screw up the notification.
I'm using GeneXus Evo 3 U2, .NET generator and Oracle.
Any suggestion how to fix this?
EDIT: Tested with distribuition certificate and sandbox=false, builded for distribuition and sended to testflight, same problem. =/
Have you checked that in the Provisioning Profile (developer.apple.com) the Push Notification service is active:
Enabled Services:
Game Center, In-App Purchase, Push Notifications
I fixed, here is what I did:
Updated from "U2" to "U8". Since "U8" have some OSX and XCode version requirements I updated both to the lastest versions.
Now "NotificationRegistrationHadler" is being called as normal.
I am trying to run the AWS android samples from https://github.com/awslabs/aws-sdk-android-samples
I have included the following jars in libs:
aws-android-sdk-2.0.4-cognito.jar
aws-android-sdk-2.0.4-core.jar
aws-android-sdk-2.0.4-s3.jar
Also I have added the AWS_ACCOUNT_ID, COGNITO_POOL_ID, COGNITO_ROLE_UNAUTH, BUCKET_NAME
this is the logcat
When im runnig this sample, action and then program shuts down.
What is problem?
I don't know what to do.
The stacktrace shows accountId is malformed. The accountId isn't your login email of your AWS account. Instead, it should be a 12 digit account number. One way to find it is to go to console -> My Account (top right corner).
PS: consider use the latest SDK version v2.2.2. It has lots of improvements compared to v2.0.4. You can find it at http://aws.amazon.com/mobile/sdk/.
I downloaded the sdk from here, created an application but when i run the app the logcat notifies:
Error 401, Failure: You are not authorized.
I tested the Bluemix app with the sample code you can find here, obviously switching the default parameters with my app's ones.
Solved.
I downloaded the April jars, the most recent ones. That worked.
A 401 error sounds as if the Mobile Application Security (MAS) is not set up correctly. Could you try going to your mobile back end on Bluemix, clicking the MAS service, turning the "Enable Client List" switch to on, and then adding your bundle id under iOS? Additionally, confirm that you've copied the client-id & client secret correctly into the properties file for the application.
I am following Android Push Notifications using Google Cloud Messaging (GCM) to implement GCM with my application it was working fine on single device (Galaxy S) when i tried to test it with another device( Galaxy Tab 7') its generating error.
handleRegistration: registrationId = null, error = INVALID_SENDER, unregistered = null
here is the Log which i am getting
V/GCMRegistrar(5649): Registering app my_maypackage of senders APA91bHvzZbO_nyYvaA_QRGDaV-wRAYKjt0qJSQmzPUi2unqG7j0OGuyhVY1A3zh-ZfnA0XT0ffgyKypVJ_5owLZvZBNGARpTBkBg9ED8gVVCDejaIpShghq_tXGhMnFQEufwdCL1ibm
V/GCMRegistrar(5649): Setting registeredOnServer status as true until 2013-04-02 11:02:07.847
V/GCMBroadcastReceiver(5649): onReceive: com.google.android.c2dm.intent.REGISTRATION
V/GCMBroadcastReceiver(5649): GCM IntentService class: my_maypackage.GCMIntentService
V/GCMBaseIntentService(5649): Acquiring wakelock
V/GCMBaseIntentService(5649): Intent service name: GCMIntentService-980172650021-7
D/GCMBaseIntentService(5649): handleRegistration: registrationId = null, error = INVALID_SENDER, unregistered = null
D/GCMBaseIntentService(5649): Registration error: INVALID_SENDER
I/GCMIntentService(5649): Received error: INVALID_SENDER
V/GCMBaseIntentService(5649): Releasing wakelock
Note: both devices are configured with same gmail account.
Log is showing incorrect sender ID. it should be taken from Google api project url. e.g
https://code.google.com/apis/console/b/0/#project:65464654646546
then 65464654646546 is sender ID.
For me what did it was enabling the "Google Cloud Messaging for Android" from the Console's API section:
[Adding to #spanjeta's answer:]
The problem is that it’s not trivial to get the project number, due to Google ever going modifications of the developer console. While Google was kind enough to give developers the possibility to declare a friendly/textual id for their projects, they didn't update the GCM documentation in that this cannot replace project ID in a GCM client.
When you do that (give the project a textual name/ID ) - you cannot use it, because you will get an INVALID_SENDER error.
You must get the pure numerical project ID somehow.
So how do you get the project number? You need to get somehow to the old developer console.
The following way works (for now):
Yo go to The developer console → Your Project → APIS → Google Cloud Messaging for Android → Quota
Then a new, old google devloper console tab will be opened with the following URL:
https://code.google.com/apis/console/b/0/?noredirect#project:YOUR_PROJECT_NUMBER:quotas
Then, use YOUR_PROJECT_NUMBER as the GCM SENDER_ID in your app.
I just wanted to share with you that I ran into this same problem just now.
GCM push worked perfectly fine before, nothing's got changed, and all of the sudden our users flushed back with complaints about not getting push notifications.
So I did check out all the StackOverflow thread re. this issue and still couldn't figure things out (had the app id / keys all correctly input, code's perfectly fine, even tried out on the Google demo and blah blah blah)
So in an act of desperate I went to the dev console and disabled GCM, then re-enabled it... everything just worked!
There is a project ID and the Project Number shown on the top of the Project Dashboard.
Project ID: aaaa-bbb-000000 Project Number: 00000111112
You have to use the numeric Project Number as SENDER_ID.
maybe you need change the GOOGLE_PROJ_ID
First
Second
Good Luck!!