I am getting the following exception reported in my Google Analytics for Android app.
ParseRequestException (#ParseRequest:newPermanentException:352) {main}
This is the top exception with more than 4000 hits. I am worried that some users are not able to register on parse and unable to receive push notifications. Unfortunately, I don't have any other information being reported and I am unable to replicate this on any Android devices that I have.
Here is the code, where I am initializing Parse:
Parse.initialize(this, "XXX", "YYY");
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
#Override
public void done(ParseException e) {
if (e != null) {
Utils.sendException(appContext, e);
}
}
});
PushService.setDefaultPushCallback(this, ChatActivity.class);
ParsePush.subscribeInBackground(getResources().getString(R.string.parse_default_channel), new SaveCallback() {
#Override
public void done(ParseException e) {
if (e != null) {
Toast.makeText(appContext, "Problem subscribing to the chat service. You will not be able to receive notifications!", Toast.LENGTH_LONG).show();
Utils.sendException(appContext, e);
}
}
});
When I searched for this Exception on Google, I found only 3 results and they don't have any info. I want to know:
1. If I am doing something wrong?
2. How this may be hurting my app's users?
3. How to solve this?
Thanks in advance!
Related
I am not sure if I am missing a step in the process of linking a Facebook account to an existing Parse User.
This is the code I am using, as per Parse.com
if (!ParseFacebookUtils.isLinked(currentUser)) {
ParseFacebookUtils.linkWithReadPermissionsInBackground(currentUser, getActivity(), null, new SaveCallback() {
#Override
public void done(ParseException ex) {
if (ex == null) {
if (ParseFacebookUtils.isLinked(currentUser)) {
Log.d("MyApp", "Woohoo, user logged in with Facebook!");
}
} else {
Log.e(TAG, ex.getMessage());
}
}
});
}
I am not receiving any type of error, and it will successfully open up the Facebook activity to accept/cancel giving access to my application. The issue that I am finding, is that the authData section inside my User record, inside Parse, is never populated.
What am I doing wrong that my Parse User is not receiving any authData?
Do you happen to add the code to fragment?
If you do that, you should consider about onActivityForResult.
As you know, onActivityForResult is not called normally.
I've started using parse.com to receive push notifications in my application.
It works perfectly, but I have a couple of questions.
We perform registration, but unused channels, as follows:
ParsePush.subscribeInBackground("", new SaveCallback() {
#Override
public void done(ParseException e) {
if (e == null) {
Log.d("dmode", "Oks!");
} else {
Log.e("dmode", "Fail :(", e);
}
}
});
My first question is:
I find no way to disable receiving push notifications
I searched the official documentation and stackoverflow, but I find solutions that do not work for me.
I tried:
ParsePush.unsubscribeInBackground("", new SaveCallback() {
#Override
public void done(ParseException e) {
if (e == null) {
Log.d("dmode", "unsuscribe oks");
} else {
Log.e("dmode", "unsuscribe fail", e);
}
}
});
Unsuccessfully, I have also tried:
ParsePush.unsubscribeInBackground("");
...but not work.
I'm not using channels, that is why the quotes are empty:
ParsePush.subscribeInBackground("", new SaveCallback() { //...
How I can enable and disable push notifications?
The second query is that sometimes receive duplicate notifications until two three times at once on the same device.
Someone has been the same?
Thank you very much for the help.
Greetings!
I think you should use a name for a default channel even if you are not using channels and not the empty string "".
Also have a look here Parse Question
I quote from the answer on the above link
If you called PushService.setDefaultCallback, call it again passing null as the class.
I'm looking for some help with push notifications on Android.
Situation:
I'm trying to do a push send from an Android device, at this time for itself ( will understand later) but when I hit the send button nothing happens
Config:
Firstly, yes, the client side push is enabled.
Secondly my onCreate method in the "extends Application" class
public void onCreate() {
super.onCreate();
//Parse
//Parse.enableLocalDatastore(this);
Parse.initialize(this, "", "");
ParseObject.registerSubclass(Groups.class);
ParseObject.registerSubclass(Users.class);
//Subscribe to push
ParsePush.subscribeInBackground("", new SaveCallback() {
#Override
public void done(ParseException e) {
if (e == null) {
Log.d("com.parse.push", "successfully subscribed to the broadcast channel.");
} else {
Log.e("com.parse.push", "failed to subscribe for push", e);
}
}
});
// Save the current Installation to Parse.
ParseInstallation.getCurrentInstallation().saveInBackground();
}
My button to send the push notification ( its the basic code from the docs )
sendReqBtn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
System.out.println("Debug push onclick");
ParsePush push = new ParsePush();
push.setChannel("");
push.setMessage("The Giants just scored! It's now 2-2 against the Mets.");
push.sendInBackground(new SendCallback() {
#Override
public void done(ParseException e) {
System.out.println("Push send done");
}
});
}
});
All other settings set by the basic android tutorial (Like manifest and basic sdk adding, I already use other parse functions)
So after this code snippets added to my app I hoped that I will get a notification on the device itself as described earlier, but nothing happens. From the parse push dashboard I tried it, and it works fine (thats why I think the manifest and other things are configured well) and in the core panel on the dashboard i can see the installation in the list and the "" mark in the channels array.
Can anyone help me out?
Thanks in advance!!
Steve
After the installation has been made I need to get the deviceToken for other purposes. This is what I developed so far:
Parse.initialize(this, "qqd423WEfwWEF32FewferT434fs323rfRT", "g7Rre4g7gsGRwgGw458Hdf443gFHk534Mrtg34");
final ParseInstallation currentInstallation = ParseInstallation.getCurrentInstallation();
currentInstallation.saveInBackground(new SaveCallback() {
public void done(ParseException e) {
if (e == null) {
System.out.println("ok");
deviceToken = currentInstallation.get("deviceToken").toString();
System.out.println(deviceToken);
} else {
System.out.println("not ok");
}
}
});
The problem is that if I execute the code the app crashes and this is the error generated:
02-02 09:44:17.151 ﹕ FATAL EXCEPTION: main, PID: 5855 java.lang.NullPointerException
and the piece of code that generates this is this piece:
deviceToken = currentInstallation.get("deviceToken").toString();
is there anybody who can help me? I simply need to get the deviceToken after the installation is made.
There is no problem in code, I guess you are testing this code in emulator and in emulator it will not have any deviceToken, try your code in real device.
Might be Late but also might be helpfull :)
Parse sometimes has some delays to when the done() method is called, I've seen it being called after I played around with the application for 3 minutes and exit it.
I used a different order for the method calls:
Parse.initialize(this, "*******", "*******");
ParsePush.subscribeInBackground("", new SaveCallback()
{
#Override
public void done(ParseException e)
{
if (null == e)
{
ParseInstallation install = ParseInstallation.getCurrentInstallation();
String token = install.getString("deviceToken");
if (token != null)
{
//saved it locally and other stuff
}
else
{
//saved a temporary default value locally
}
}
}
});
ParseInstallation.getCurrentInstallation().saveInBackground();
Hope this Helps in some way.
After calling code below for several times(5-10 times), done() method for SaveCallback doesn't fire and whole application seems to stuck. It seems that this request ruins request queue and all further queries doesn't fire their callbacks either. No errors in callbacks and in logs. " BEFORE SAVING" - displayed in logs, while " SAVED" - didn't.
Do I need to change parse pricing contract, or to change my code somehow?
Log.d("MESSAGE OBJECT", " BEFORE SAVING");
messageParseObject.saveInBackground(new SaveCallback() {
#Override
public void done(final ParseException e) {
Log.d("MESSAGE OBJECT", " SAVED");
if (e != null){
completitionCallback.error(e);
return;
}
chatObject.put(ModelConstants.LAST_MESSAGE_KEY, messageParseObject);
chatObject.getRelation(ModelConstants.MESSAGES_KEY).add(messageParseObject);
chatObject.saveInBackground(new SaveCallback() {
#Override
public void done(ParseException e) {
Log.d("CHAT OBJECT", " SAVED");
if (e == null)
completitionCallback.success();
else
completitionCallback.error(e);
}
});
}
});
Faced this and really drove me crazy. This is what I found. If the Class is already created in Parse.com, even if there is a small discrepancy saveInBackground and saveEventually fails without any error.
Best way, if this happens is to delete the created class in Parse.com and let the android SDK call it it automatically in the first invocation.
At least that did the trick for me.