Titanium version: 3.1.3.
I'm still using MQTT for Android and everything worked fine until a few weeks ago (maybe until mqtt on acs got deprecated). But I read that it is possible to still use MQTT (instead of gcm). According to another post on appcelerator I just had to define mqtt in the tiapp.xml, but this does not work.
This is part of my tiapp.xml
<property name="acs-push-type-development" type="string">mqtt</property>
<property name="acs-push-type-production" type="string">mqtt</property>
<property name="acs-push-type" type="string">mqtt</property>
...
<module platform="android" version="2.3.2">ti.cloudpush</module>
<module platform="android" version="2.1.2">ti.map</module>
<module platform="commonjs" version="2.3.7">ti.cloud</module>
That is what I get from the appcelerator logs:
`"response": {"push_log_details": [
{
"created_at": "2014-05-12T13:02:35.389Z",
"updated_at": "2014-05-12T13:02:31.094Z",
"type": "android",
"android_type": 1,
"app_id": "52724d7cd72ec85152039256",
"channel": "stickin",
"_id": "5370c66be511ea7ab99881d4",
"token": "ND1M2IX8RU8RGJDICW13I9V",
"push_id": "5370c6641316e90db2311567",
"send_status": 2,
"sent_at": "2014-05-12T13:02:30.996Z",
"error_message": "argument cannot be null",
"msg_id": "fa89cfb6-f2d2-4222-b442-a47d2625b419"
},
{
"created_at": "2014-05-12T13:02:35.389Z",
"updated_at": "2014-05-12T13:02:31.094Z",
"type": "android",
"android_type": 1,
"app_id": "52724d7cd72ec85152039256",
"channel": "stickin",
"_id": "5370c66be511ea7ab99881d6",
"token": "ND13ST3OA0MHE079H6EYV8P",
"push_id": "5370c6641316e90db2311567",
"send_status": 2,
"sent_at": "2014-05-12T13:02:30.996Z",
"error_message": "argument cannot be null",
"msg_id": "77fc5c7f-9703-46e5-a433-7be0796421f2"
}, .....
`
"argument cannot be null" seems like a gcm response code. I tried removing apiKey and sender id of gcm and to only save the Application Packagename (MQTT), but then I get the error gcm_apiKey is null. I thought push is not using gcm if I define mqtt in the tiapp.xml? By the way, on iOS everything is working fine, but of course mqtt is not used there.
Check the following
CloudPush module version you are using should be below 3.2.0
You should specify 'android' as type while subscribing to the push notification. (in the case of GCM, you have to use 'gcm')
However Appcelerator has removed the MQTT support from March 15th 2014..
So latest CloudPush modules will not support MQTT anymore.
See the below screenshot. You may see this on the ACS server. You need to upgrade your app to GCM to fix the issues and upgrading to GCM is pretty simple. I had already done it earlier. I suggest you should upgrade your app to GCM support.
Also visit Android Push Notification: Deprecating MQTT in favor of GCM in Appcelerator Blog.
Related
I and my colleagues keep running into this error again and again.
The console looks something like this:
Having 3 different people working on a single Android project.
After downloading the JSON file and pasting it in the appropriate location. App directory in Android project.
Now, as soon the app starts and asks for authentication, phone authentication is in my case. The following error is thrown in LOGCAT.
E/FirebaseAuth: [SmsRetrieverHelper] SMS verification code request failed: unknown status code: 17499 Requests from this Android client application ____package name_____ are blocked.
E/AuthUI: A sign-in error occurred.
com.google.firebase.FirebaseException: An internal error has occurred. [ Requests from this Android client application ___package name_____ are blocked. ]
at com.google.android.gms.internal.firebase-auth-api.zzti.zza(com.google.firebase:firebase-auth##21.0.3:4)
at com.google.android.gms.internal.firebase-auth-api.zzuc.zza(com.google.firebase:firebase-auth##21.0.3:1)
at com.google.android.gms.internal.firebase-auth-api.zzud.run(com.google.firebase:firebase-auth##21.0.3:3)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:226)
at android.app.ActivityThread.main(ActivityThread.java:7178)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
The Authentication works perfectly fine on the first device I was using but if I add any further Sha-1 or Sha-256 to the console, it throws an error.
Alright, so I found the solution to my problem.
The error clearly says "SMS verification code request failed: unknown status code: 17499 Requests from this Android client application package name_ are blocked."
The problem was basically that there are 3 different persons working on the project, and each person would be assigned a separate oauth_client cliend_id. Now if we download JSON files directly from firebase, there are a few issues. It should look something like this:
{
"project_info": {
"project_number": "______",
"firebase_url": "_______",
"project_id": "______",
"storage_bucket": "_______"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "mobile_project_id",
"android_client_info": {
"package_name": "________"
}
},
"oauth_client": [
{
"client_id": "client_id_0",
"client_type": 1,
"android_info": {
"package_name": "______",
"certificate_hash": "______"
}
},
{
"client_id": "client_id_4",
"client_type": 3
}
],
"api_key": [
{
"current_key": "api_key_0"
},
{
"current_key": "api_key_1"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "some_client_id",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
Now, as you can see in oauth_client there are 2 clients, if I remove client_id_4 data, it wouldn't matter much since my client id data is in client_id_0 and the android app would work perfectly fine.
Downloading JSON file and using it directly works well only when you have 1 app and 1 person working on it but if there are many different devices and many different persons working on the project, you need to take matters into your hands.
The solution to the problem is:
If you have API Keys assigned specifically for a project check if it's correct or not. (ex. api_key_0 is right and api_key_1 is not of this project, so you need to remove api_key_1).
In the oauth_client keep only one client_id, specifically which belongs to you else it will throw the same error as I was getting.
For those wondering where to find oauth_client client_id Google Cloud Platform and navigate to the section where it says "OAuth 2.0 Client IDs". Search for the one related to yours.
And finally, make changes appropriately.
The problem was because Firebase was reading wrong client_id from the JSON file even if the correct one was mentioned.
I have created ASP.NET Core project with Angular Template with authentication using visual studio. Now I am developing Android App and want to integrate it with my existing ASP.NET CORE 3.1 WEB API (Backend).
I have added client in appsettings.json for my android app as follow:
"IdentityServer": {
"Clients": {
"MyAngularApp": {
"Profile": "IdentityServerSPA"
},
"MyMobileApp": {
"Profile": "NativeApp"
}
}
}
When I call my configuration endpoint "https://localhost:4042/_configuration/MyMobileApp", I got the following response;
{"authority":"https://localhost:4042","client_id":"MyMobileApp","redirect_uri":"urn:ietf:wg:oauth:2.0:oob","post_logout_redirect_uri":"urn:ietf:wg:oauth:2.0:oob","response_type":"code","scope":"offline_access MyAppAPI openid profile"}
I have the following Question;
what does "urn:ietf:wg:oauth:2.0:oob" means in the redirect_uri?
When I added redirect_uri in client settings like this,
"MyMobileApp": {"Profile": "NativeApp","RedirectUri": "com.example.myapplication"}
but I didn't get my defined redirect_uri when I call the endpoint
"https://localhost:4042/_configuration/MyMobileApp", In response I got this
"redirect_uri":"urn:ietf:wg:oauth:2.0:oob". So, how can I change the default RedirectUri?
I am using AppAuth library in Android for integrating with Identity Server.
In appsetting.json try you have to IdentityServer - Clients try this may be your issue will be resolve
"IdentityServer": {
"IssuerUri": "urn:sso.company.com",
"Clients": [
{
"Enabled": true,
"ClientId": "local-dev",
"ClientName": "Local Development",
"ClientSecrets": [ { "Value": "<Insert Sha256 hash of the secret encoded as Base64 string>" } ],
"AllowedGrantTypes": [ "implicit" ],
"AllowedScopes": [ "openid", "profile" ],
"RedirectUris": [ "https://localhost:5001/signin-oidc" ],
"RequireConsent": false
}
]
}
A have a big project with a lot of dependencies including Firebase.
Now com.google.firebase:firebase-messaging has version 17.3.3. I want to update it to the 20.2.1.
I'm getting next error after app has started:
Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [403 Forbidden: {
"error": {
"code": 403,
"message": "Requests from this Android client application com.example are blocked.",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/61947752567/apiui/credential"
}
]
}
]
}
}
]
Firebase Installations can not communicate with Firebase server APIs due to invalid configuration. Please update your Firebase initialization process and set valid Firebase options (API key, Project ID, Application ID) when initializing Firebase.
We use google-services.json to configure FCM in our app. We do not use FirebaseOptions in code.
I've noticed that the problem is connected with updating FCM to 20.1.1. And what Google says about FCM 20.1.1:
The Firebase Cloud Messaging and Firebase Instance ID SDKs now transitively depend on the Firebase installations SDK. If you use Cloud Messaging and update your dependencies to their latest versions, make sure that push notifications still work as expected.
I read an instruction from Google but no success. What I tried:
Re-download google-services.json from Firebase console. No success because it's identical.
Apply instruction about API-Key restrictions inside Firebase Console. It turned out that we don't have any restrictions ("Don't restrict key" option is checked).
Update all of Firebase (including firebase-perf) and GCM dependencies to the latest versions. No changes.
Set App ID, project ID and API-Key with FirebaseOptions right in the code before calling initializeApp method.
It also turned out that installed from APK application works correctly! If I use .aab (App Bundle) - I'm getting this error. I also use the latest bundletool.
firebase-messaging is included into our main app-module and it's one of the main features of application. I'm not talking about dynamic modules - the problem is with the main module.
I can't setup FCM again because there are a lot of users who use this application now. Also I can't understand why I have to set valid options (API key, Project ID, Application ID) if this options work great for last few years and google-services.json has not changes.
I will be grateful for any ideas.
P.S. I can't use FCM 20.1.0 because I need to integrate ML Kit dependency. It works only with actual version of FCM and crashes with FCM 20.1.0
Sometimes the project needs a simple rebuild/clean as precompiled outdated files (json/xml) stays in the precompiled version of the project.
Run in Android IDE: Build -> "Clean Project" and "Build" -> "Rebuild Project".
This won't help in all cases. Redownloading the google-services.json file may be better instead of editing/checking it manually. Don't forget to rebuild/clean after replacing the file.
In my case, I made 2 applicatiions in 1 firebase project. google-services.json downloaded from firebase has 2 client informations. I get the same error with this setup.
{
"project_info": {
"project_number": "xxxxxx",
"firebase_url": "xxxxxx.firebaseio.com",
"project_id": "xxxxxx",
......
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "xxxxxx",
"android_client_info": {
"package_name": "application-1"
}
},
.......
"api_key": [
{
"current_key": "(API-Key for application1)"
},
{
"current_key": "(API-Key for application2)"
}
],
.......
},
{
"client_info": {
"mobilesdk_app_id": "xxxxxx",
"android_client_info": {
"package_name": "application-2"
}
},
......
"api_key": [
{
"current_key": "(API-Key for application1)"
},
{
"current_key": "(API-Key for application2)"
}
],
......
}
],
"configuration_version": "1"
}
I edited google-services.json and made it simple for application-2. This works well.
{
"project_info": {
"project_number": "xxxxxx",
"firebase_url": "xxxxxx.firebaseio.com",
"project_id": "xxxxxx",
......
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "xxxxxx",
"android_client_info": {
"package_name": "application-2"
}
},
......
"api_key": [
{
"current_key": "(API-Key for application2)"
}
],
......
}
],
"configuration_version": "1"
}
I'm developing an Ionic (version 1.3.1) application and trying use Ionic push.
The application is correctly registering to ionic server but I still don't receive any notification in my device. The only error I get is the below notification status:
{
"notification": "808cde89-eb21-40d7-9999-b86e5f86f1d3",
"token": {
"type": "android",
"token": "dkYxYGcKeNo:APA91bE4OXhzkOUOSF1EsXxgY9Cd0Uu9-A98Ak5prdMIGUd10tLljacgKs7zAp1WPLF-bDiy3pkdroc9l8vWy4sXdfansr56-rIF59wJfR1e7EibJZHFO5DFxCThpT_ZgVn_T_0n8an1",
"id": "ea40d3bc7561cc4f0d28ac49ce87fd3a",
"app_id": "7ab91503",
"invalidated": null,
"created": "2016-09-17T11:31:53.481151+00:00",
"valid": true
},
"uuid": "0ebe9454-aebc-4c0b-b5b0-056920817f56",
"status": "error",
"error": "GCM_INVALID_AUTH",
"created": "2016-09-17T14:31:20.517783+00:00",
"user_id": null
}
I'm supposing ionic server is not sending the notification to device as the status is error, but I don't know the reason why I'm getting this GCM_INVALID_AUTH error. What could cause this problem?
You need migrate your project from GCM to FCM (firebase cloud message) , and use new server key.
SOLVED
I was using the wrong credentials from Google Cloud Platform. When I set to server key the problem was solved.
I am using Android Google App invite sample and following all guidelines but it is not sending any messages and emails, it gives message
Message Failed to Send
and in logs i am getting
onActivityResult: requestCode=0, resultCode=3`
getInvitation:onResult:Status{statusCode=CANCELED, resolution=null}
One possibility is an issue with your client configuration file. Make sure you followed Step 2: get a configuration file in the App Invites guide and have added the the google-services.json file to your project.
Check that package_name and certificate_hash match your credentials in Developers Console for the Default Demo App. Note: the certificate_hash will not have the colon delimiters.
// from: google-services.json
...
"oauth_client": [
{
"client_id": "<id>",
"client_type": 1,
"android_info": {
"package_name": "com.google.android.gms.samples.appinvite",
"certificate_hash": "<Signing-certificate fingerprint>"
}
}
],
In my case I was creating dubug build. But when I change Build variants from debug to release the problem solved.