Reputation: 3539
I am having a tough time in finding out the solution of this error:
GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included
I am using CloudPush module, and the weird thing is that till yesterday everything was working perfectly and I was receiving push messages properly. I tried receiving more than 100 push messages.....but suddenly it stopped working and even I am not getting any device token.
var CloudPush = require('ti.cloudpush');
if (CloudPush.isGooglePlayServicesAvailable()) {
CloudPush.retrieveDeviceToken({
success : tokenSuccess,
error : tokenError
});
// Process incoming push notifications
CloudPush.addEventListener('callback', pushRecieve);
} else {
alert("Please enable Google Play Services to register for notifications.");
}
This is the code I have been using, but God knows why it stopped working suddenly. The only thing I can remember I changed in between is updating the Titanium SDK to 5.3.0.GA, Studio to 4.6.0 and so does everything to its latest version including the CLI also.
But I have been still using 5.2.2, can anyone help me on this or is this going to be rare kind of bug...????
Upvotes: 0
Views: 189
Reputation: 3539
Finally, I found the solution (but do not know what the actual reason was).
I implemented this code:
var CloudPush = require('ti.cloudpush');
Ti.API.info('\n*Play Service = ' + CloudPush.isGooglePlayServicesAvailable());
Ti.API.info('*SERVICE_DISABLED = ' + CloudPush.SERVICE_DISABLED);
Ti.API.info('*SERVICE_INVALID = ' + CloudPush.SERVICE_INVALID);
Ti.API.info('*SERVICE_MISSING = ' + CloudPush.SERVICE_MISSING);
Ti.API.info('*SERVICE_VERSION_UPDATE_REQUIRED = ' + CloudPush.SERVICE_VERSION_UPDATE_REQUIRED);
Ti.API.info('*SUCCESS = ' + CloudPush.SUCCESS);
if (CloudPush.isGooglePlayServicesAvailable() == 0) {
CloudPush.retrieveDeviceToken({
success : function (e) {
Ti.API.info('** deviceToken == ' + e.deviceToken);
},
error : tokenError
});
CloudPush.addEventListener('callback', pushRecieve);
} else {
CloudPush.clearStatus();
CloudPush.retrieveDeviceToken({
success : function (e) {
Ti.API.info('** deviceToken == ' + e.deviceToken);
},
error : tokenError
});
}
So, the solution was to call this method CloudPush.clearStatus() and getting token again.
But still the error is there on console inspite that I am receiving the token successfully.
This is the console output:
[INFO] : GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
[INFO] : *Play Service = 0
[INFO] : *SERVICE_DISABLED = 3
[INFO] : *SERVICE_INVALID = 9
[INFO] : *SERVICE_MISSING = 1
[INFO] : *SERVICE_VERSION_UPDATE_REQUIRED = 2
[INFO] : *SUCCESS = 0
[INFO] : GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
[INFO] : ** deviceToken == AP.......qK
In my previous code, I did a mistake that I thought CloudPush.isGooglePlayServicesAvailable() will return true for success, but it actually returns a number (printed above), then I got the idea of making it correct.
But it did not work either until I called CloudPush.clearStatus().
Hope it will help someone :)
Upvotes: 1