Open marcelinne opened 7 years ago
Hello,
Have you tried calling manual registration?
Something like this in your app.component.ts:
if (window['ParsePushPlugin'] !== undefined) {
let ParsePushPlugin = window['ParsePushPlugin'];
ParsePushPlugin.register(() => {
}, (e) => {
});
or setting up the following line in the config.xml
<preference name="ParseAutoRegistration" value="false" />
Thank a lot @cleever for the helping, I've just tried and also it is not working yet :'( .The Installation class continues empty. I'm going to share you my AndroidManifest.xml `
`
Your AndroidManifest.xml seems fine. Did you put the registration inside a platform.ready() function?
Also, what about the following line in your config.xml ?
<preference name="ParseAppId" value="YOUR_APP_ID" />
Yes I did put the register function in platdorm.ready() and also a message if it is succesful or there is some error, and the succesful message is thrown, but still no creating the installation.
About the ParseAppId, yes I added in my code, sorry my mistake I did not added above, I'll update.
Ok.
Try to set your clientKey on parse-server, and restart the server. After that, put your clientkey in config.xml:
<preference name="ParseClientKey" value="your-parse-client-key" />
It is frustrating, also that way is not working, but shouldn't be requiered as well as clientKey is used with Parse are no longer necessary with Parse Server.
After debugging I see that this part of the code is thowing an error (ParsePushApplication.java line79): `
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
@Override
public void done(ParseException ex) {
if (null != ex) {
Log.e(LOGTAG, ex.toString());
} else {
Log.d(LOGTAG, "Installation saved");
}
}
});
`
The error is:
com.parse.ParseRequest$ParseRequestException: bad json response
Strange...
I have ionic1 and ionic2 apps working well with this plugin, with the same configuration:
platform.ready().then(() => {
if (window['ParsePushPlugin']) {
ParsePushPlugin.register(function () {
}, function () {
});
ParsePushPlugin.getInstallationId(function (id) {
// note that the javascript client has its own installation id,
// which is different from the device installation id.
alert("device installationId: " + id);
}, function (e) {
alert('error');
});
At config.xml:
<preference name="ParseAppId" value="appid" />
<preference name="ParseClientKey" value="clientid" />
<preference name="ParseServerUrl" value="serverurl/" /> <-- Do not forget the backslash at the end
<preference name="ParseGcmSenderId" value="gcmid" />
<preference name="ParseAutoRegistration" value="true" />
...
<plugin name="parse-push-plugin" spec="https://github.com/taivo/parse-push-plugin" />
That's is all you need to get the plugin working. All my parse instances requires ClientKey.
I think these links may help you: https://github.com/taivo/parse-push-plugin/issues/52 https://github.com/taivo/parse-push-plugin/pull/57 https://github.com/taivo/parse-push-plugin/issues/79
can you please tell me how to import into ts file
@drmark1989 if you are using ionic2, the only thing you need is add this line in your ts file:
declare var ParsePushPlugin: any;
The place where you should add is after the imports, like this:
import { AlertController } from 'ionic-angular';
import { LoadingController } from 'ionic-angular';
......
declare var ParsePushPlugin: any;
That is it! Regards
Hi I'm using ionic2, but it never creates the installation, is something more what we should change in order to use ionic2 ?, ParsePushPlugin.getInstallationId is working fine, it gets me an id, but when I check in database the "Installation" class continues empty, do you have any idea what it could be? Thanks in advance.
Here is my configuration in parse server:
`
var api = new ParseServer({
}
}); `
My cloud function: `
Parse.Cloud.define('sendPush', function(request, response) {
}); `
In ionic2 after install parse-push-plugin, I added this to my config.xml: `
In my ts file after the imports: `
declare var ParsePushPlugin: any; `
Then in the constructor class: `
ParsePushPlugin.getInstallationId(function(id) {
` This last part gets me the installation id, but after check in database none row is created! Please help, I'm missing some configuration? Thanks in advance