As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Getting error while using push notification GCM - onError: INVALID_PARAMETERS
s
sandip_armal
started a topic
over 9 years ago
Good morning, I am Sandeep Armal trying to use kinvey with my app. I go through http://devcenter.kinvey.com/android/guides/getting-started this and tried to learn and setup Kinvey in my project. So what i do
1. First i create account on Kinvey and get app_key and app_secret.
2. then i create app on Google Developer Console for Google Cloud Messagin from here https://cloud.google.com/console . After creating app I got project_id and project_number then i create Android and server key.
3. Then I put project_number and adnroid_key(also tried with server key) here [https://console.kinvey.com/apps/will-power-kid_eV4yphmAnO/addons/push/configure](https://console.kinvey.com/apps/will-power-kid_eV4yphmAnO/addons/push/configure "https://console.kinvey.com/apps/will-power-kid_eV4yphmAnO/addons/push/configure")
So i though i done with getting keys and putting it so then I move to my client code.
i done all code which mentioned here http://devcenter.kinvey.com/android/guides/push
But when i run project i get ping success message but also i get
Log.i("TEST", "GCM - onRegister, new gcmID is: " + gcmID);
}
@Override
public void onUnregistered(String oldID) {
Log.i("TEST", "GCM - onUnregister");
}
}
GCMReceiver.java
public class GCMReceiver extends GCMBroadcastReceiver {
@Override
public String getGCMIntentServiceClassName(Context context){
return "com.donow.donow.MyGCMLoggingReceiver";
}
}
Sorry for big code but stuck from last three days. And really want to integrate Kinvey with my app.
Forgot one thing. i added all libs for Kinvey and gcm.jar also.
I thing i done all code from my side now if i send message from this link https://console.kinvey.com/apps/will-power-kid_eV4yphmAnO/addons/push/send then I should get push notification
Hi Sandip, @Edward‌ is going to take a look at this and see if there's something impacting the GCM service.
E
Edward
said
over 9 years ago
Hey Sandip.
INVALID_PARAMETERS is an error directly from google, which unfortunately isn't very well documented.
When you test this, are you running it on a physical device or an emulator? What version of android?
Also, can you try removing the empty white spaces after the sender id in `kinvey.properties`? It might be an issue with our string parser, pulling in the spaces into the sender id.
s
sandip_armal
said
over 9 years ago
Hi @Edward @caroline I am testing this on physical device Android OS version 4.2 Jelly Bean. There is no white spaces in `Kinvey.properties` file after parameters.
P
Pankaj Chawla
said
over 9 years ago
Hi Ed,
I also seem to be having a problem with GCM. None of the PUSH notifications are reaching my device even though console says its successfully sent. Tried both through custom BL code as well as using the "Send Push Notification" page from console.
C
Caroline
said
over 9 years ago
We've noticed a bunch of issues for people using GCM. We're investigating now to see if something has changed about the API.
c
camiloramirezqf
said
over 9 years ago
The problem is in the GCM library that Kinvey uses, it is obsolete since last year, you have to use Google Play Services for push functionality. Kinvey team should migrate to the new library ASAP before the old protocol stops working.
s
sandip_armal
said
over 9 years ago
@camiloramirezqf Then how we can use Kinvey if they are not going to fix it? @caroline , @Edward
E
Edward
said
over 9 years ago
Hey,
I do have an open ticket for upgrading the push implementation, and will be getting to it soon--
In the meantime, the current implementation is still supported by Google, and support has not been dropped. Still, there is a lot of configuration required on both the client side as well as on the google cloud console. The above configuration does look correct, and also ensure that there is a `gcm.jar` copied out of the `extras` directory from your android sdk into the `/libs` directory.
Assuming that is there, on the google cloud console ensure you have followed these steps:
1. Create a new project
2. Activate the `Google Cloud Messaging for Android` API, under the API & Auths Tab -> APIs
3. Under APIs & Auths Tab -> Credentials, create a new `Server Key`, and leave the allowed IP field blank.
4. Use this server key in your push configuration at www.console.kinvey.com
One last recommendation-- note that `onMessage` currently only writes to the logs, and it can be easily missed. Try adding the following code to your `onMessage` method:
@edward @caroline I add notification code along with Log but i am not able to even register user for GCM because following log is also not printed in LogCat.
`@Override
public void onRegistered(String gcmID) {
Log.i("TEST", "GCM - onRegister, new gcmID is: " + gcmID);
}`
Even i tried to check whether push notification functionality is enabled or not then i get `false`
`mKinveyClient.push().isPushEnabled()`
I really want to use Kinvey but it's not working even in my sample app then how can i use it in my production build?.
BTW Thanks for your response time by time.. hope you will solve this issues asap.
Thank you..
E
Edward
said
over 9 years ago
Hey,
so the issue here is "INVALID_PARAMETERS", coming from google.
Can you try registering directly? Note this is the same thing the library does, I am just curious as to what happens when you run it inside your application:
GCMRegistrar.register(getApplication(), new String[]{"MY_GCM_ID"});
Can you post the value of curID after running the above code? Also, let me know if you still see the same issue with that direct call to register.
s
sandip_armal
said
over 9 years ago
@Edward Thanks for your answer. Currently i am trying to create collection and get data from that collection.. will back on GCM next week. So will update you on this. Thank you.
s
sandip_armal
said
over 9 years ago
@Edward Here is my CurId:-
`CUR ID = APA91bFjaEea6H2RjWu6vlehavc_5lrqyG--g2Puxim9JuIISmxdKlkRUpcg8oMpZnspqiULk9CavkfiL4MgYk5tEOvRwS9JxERvSz3FYA_d0-ZfhboqLuVJB48WfGgkCnSSRXsyPXsvorydF45toRi4CjiGl14OSw`
s
sandip_armal
said
over 9 years ago
@Edward Awesome.... your new GCM registration code is working shamelessly... Perfect what i want..... Thank you!
sandip_armal
1. First i create account on Kinvey and get app_key and app_secret.
2. then i create app on Google Developer Console for Google Cloud Messagin from here https://cloud.google.com/console . After creating app I got project_id and project_number then i create Android and server key.
3. Then I put project_number and adnroid_key(also tried with server key) here [https://console.kinvey.com/apps/will-power-kid_eV4yphmAnO/addons/push/configure](https://console.kinvey.com/apps/will-power-kid_eV4yphmAnO/addons/push/configure "https://console.kinvey.com/apps/will-power-kid_eV4yphmAnO/addons/push/configure")
So i though i done with getting keys and putting it so then I move to my client code.
i done all code which mentioned here http://devcenter.kinvey.com/android/guides/push
But when i run project i get ping success message but also i get
04-10 11:38:43.039: I/TEST(28709): GCM - onError: INVALID_PARAMETERS
Manifest.xml
package="com.donow.donow"
android:versionCode="1"
android:versionName="1.0" >
android:minSdkVersion="11"
android:targetSdkVersion="18" />
android:name="com.donow.donow.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:name="com.donow.donow.MainActivity"
android:label="@string/app_name" >
android:name=".GCMReceiver" android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
asset.knvey.properties
app.key=
app.secret=
gcm.enabled=true
gcm.senderID=779402294429
MainActivity.java
public class MainActivity extends Activity {
Client mKinveyClient = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mKinveyClient = new Client.Builder("kid_eV4yphmAnO", "066da3be5b264e55b1a7129c8db4dc3a"
, this.getApplicationContext()).build();
/** login and fire off the ping call to ensure we can communicate with Kinvey */
if(!mKinveyClient.user().isUserLoggedIn()){
mKinveyClient.user().login(new KinveyUserCallback() {
@Override
public void onFailure(Throwable error) {
Log.e("TEST", "Login Failure", error);
}
@Override
public void onSuccess(User result) {
Log.i("TEST","Logged in a new implicit user with id: " + result.getId());
}
});
}
mKinveyClient.ping(new KinveyPingCallback() {
@Override
public void onSuccess(Boolean result) {
Toast.makeText(MainActivity.this, "kinvey ping success!",
Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Throwable error) {
Toast.makeText(MainActivity.this,
"kinvey ping failed, check res/strings for appkey and appsecret",
Toast.LENGTH_LONG).show();
}
});
mKinveyClient.push().initialize(getApplication());
}
}
MyGCMLoggingReceiver .java
public class MyGCMLoggingReceiver extends KinveyGCMService {
@Override
public void onMessage(String message) {
Log.i("TEST", "GCM - onMessage: " + message);
}
@Override
public void onError(String error) {
Log.i("TEST", "GCM - onError: " + error);
}
@Override
public void onDelete(int deleteCount) {
Log.i("TEST", "GCM - onDelete, message deleted count: " + deleteCount);
}
@Override
public void onRegistered(String gcmID) {
Log.i("TEST", "GCM - onRegister, new gcmID is: " + gcmID);
}
@Override
public void onUnregistered(String oldID) {
Log.i("TEST", "GCM - onUnregister");
}
}
GCMReceiver.java
public class GCMReceiver extends GCMBroadcastReceiver {
@Override
public String getGCMIntentServiceClassName(Context context){
return "com.donow.donow.MyGCMLoggingReceiver";
}
}
Sorry for big code but stuck from last three days. And really want to integrate Kinvey with my app.
Forgot one thing. i added all libs for Kinvey and gcm.jar also.
I thing i done all code from my side now if i send message from this link https://console.kinvey.com/apps/will-power-kid_eV4yphmAnO/addons/push/send then I should get push notification
Looking forward for help.