Push Notifications Not Being Delivered Via Custom API Services

Hello Backendless,
I was Trying to Publish Messages through Push Notification Via Custom API Services. But It Gives me the Error as :

{
  "code": 0,
  "message": "Type:\"java.lang.NoSuchMethodError\", Description:\"com.backendless.Messaging.publish(Ljava/lang/String;Ljava/lang/Object;Lcom/backendless/messaging/PublishOptions;)Lcom/backendless/messaging/MessageStatus;\", ExceptionClass:\"ServiceException\"  {Msg:\"none\", Cause:\"none\"}"
}

I could achieve the Push Notification with Same Code Via Custom Business Logic , but It’s not working with the API Services
I don’t know why it’s behaving like that :
My Code For the Push Notification which is working perfectly in the Custom Business Logic is:

PublishOptions publishOptions = new PublishOptions();
//We are going to Recieve Some Sorts of HEader off here
//Just to make Things light on the Header part
publishOptions.putHeader( "android-ticker-text", "His Book Firfire is Awesome" );
publishOptions.putHeader( "android-content-title", "Buddhi Sagar is in Laya! !! " );
publishOptions.putHeader( "android-content-text", "The Story of Firfire is Cool" ); 
DeliveryOptions options=new DeliveryOptions();
MessageStatus message=Backendless.Messaging.publish(CreatePureChannelName(comment.getParent_post().getObjectId()),comment,publishOptions);

Hi Pujan,

Internal ticket with id BKNDLSS-12836 have been created for this issue.

Regards,

Denys

Hi Pujan,

Please, verify whether your service jar does not include classes from backendless.jar.
https://backendless.com/documentation/business-logic/java/apieng_service_deployment.htm

Regards,

Denys

Hello Denys ,
I followed the Service Creation API quite properly and Have verified that my service Jar doesn’t contain classes.from Backendless.Jar
Regards

Could you please provide your service jar?

Hello @Denys Konalhevych

Okay , I tried to upload the Jar FILE , but It gives me Error as :
http://support.backendless.com/public/attachments/694e89ae792b96501a176528107e9eed.png</img>
Where can I upload the Jar File otherwise ?

Hi Pujan,

You can send it to support@backendless.com with reference to BKNDLSS-12836

Hi, Pujan!

Please generate you business logic code again:

http://support.backendless.com/public/attachments/6172c674b90979db3f8b18d0808fb6c2.png</img>

and make sure that you use

com.backendless.services.messaging.MessageStatus

instead of

com.backendless.messaging.MessageStatus

in your code.

Hello @Anatolli
I removed this specific import of MessageStatus ( Tried after replacing the import Didn’t work too )

com.backendless.messaging.MessageStatus

So , I cleaned everything without this particular Import and Again after testing , It Gives me the Same Error as :

{
  "code": 0,
  "message": "Type:\"java.lang.NoSuchMethodError\", Description:\"com.backendless.Messaging.publish(Ljava/lang/Object;Lcom/backendless/messaging/PublishOptions;Lcom/backendless/messaging/DeliveryOptions;)Lcom/backendless/messaging/MessageStatus;\", ExceptionClass:\"ServiceException\"  {Msg:\"none\", Cause:\"none\"}"
}

While The Code I am using Now is VEry Very Simple as :

PublishOptions publishOptions = new PublishOptions();
//We are going to Recieve Some Sorts of HEader off here
//Just to make Things light on the Header part
publishOptions.putHeader( "android-ticker-text", "New Laya Intereaction" );
publishOptions.putHeader( "android-content-title", "A Laya User Rated "+String.valueOf(points)+" To Your Poem" );
publishOptions.putHeader( "android-content-text", "It has now "+ finalPoints+ " Points in total" );
DeliveryOptions deliveryOptions=new DeliveryOptions();
deliveryOptions.addPushSinglecast(sourcePost.getOriginal_poster().getProperty("device_id").toString());
Backendless.Messaging.publish((Object)"Test-Stufff",publishOptions,deliveryOptions);

Regards,
Pujan

Hi, Pujan!

Did you generate your business logic code once again? It it critical, because you need the latest version of generated files.
Please try it and tell the result.

Hello @Anatolii
I didn’t get you here actually . These are my Custom API Services rather than the Business Logic Code . Do You mean to say that I have to compile the Jar With the Latest version of Generated Files ?
Regards,
Pujan

In this case, just replace backendless.jar you use with the latest one.

Hello @Anatolii
Thanks . This Finally Worked .
You Guys are Really Really Awesome :slight_smile:
I have another Ticket Pending with BKNDLSS-12799 Which is making the Release of my product really delaying
I hope you guys took take a look at it too.
Regards,
Pujan