Backendless Support
 
Solved

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 :

  1. {

    "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:

  1. PublishOptions publishOptions = new PublishOptions();
  2. //We are going to Recieve Some Sorts of HEader off here
  3. //Just to make Things light on the Header part
  4. publishOptions.putHeader( "android-ticker-text", "His Book Firfire is Awesome" );
  5. publishOptions.putHeader( "android-content-title", "Buddhi Sagar is in Laya! !! " );
  6. publishOptions.putHeader( "android-content-text", "The Story of Firfire is Cool" );
  7. DeliveryOptions options=new DeliveryOptions();

    MessageStatus message=Backendless.Messaging.publish(CreatePureChannelName(comment.getParent_post().getObjectId()),comment,publishOptions);

Leave a Comment

Comments (12)

photo
1

Hi Pujan,

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

Regards,

Denys

photo
1

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

photo
1

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

photo
1

Could you please provide your service jar?

photo
1

Hello @Denys Konalhevych

Okay , I tried to upload the Jar FILE , but It gives me Error as :

694e89ae792b96501a176528107e9eed

Where can I upload the Jar File otherwise ?

photo
1

Hi Pujan,

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

photo
1

Hi, Pujan!

Please generate you business logic code again:

6172c674b90979db3f8b18d0808fb6c2

and make sure that you use

  1. com.backendless.services.messaging.MessageStatus

instead of

  1. com.backendless.messaging.MessageStatus

in your code.

photo
1

Hello @Anatolli

I removed this specific import of MessageStatus ( Tried after replacing the import Didn't work too )

  1. com.backendless.messaging.MessageStatus

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

  1. {

    "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 :

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

Regards,

Pujan

photo
1

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.

photo
1

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

photo
1

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

photo
1

Hello @Anatolii

Thanks . This Finally Worked .

You Guys are Really Really Awesome :)

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

photo