Giter Club home page Giter Club logo

pushraven's Issues

Allow passing InputStream for service account

Currently, only File is allowed to send to the PushRaven API

If the user is loading the JSON from environment variables, it is not feasible or secure to save that to a file and then provide to PushRaven

Secondly, files are not present in ephemeral file systems provided by services like Google App Engine and Heroku

Thirdly, a developer could have also loaded GoogleCredentials for personal use of Firebase in his app and reloading the InputStream for the same purpose inside Pushraven would be somewhat unnecessary

push() call doesn't send HTTP request if response is not processed properly

Hi,

I've encountered a bug when using your library.

After notification is properly set up, calling FcmResponse resp = Pushraven.push(myNotification) doesn't actually send HTTP request to Firebase server. You have to call resp.getResponseCode() or resp.toString() afterwards for it to be sent.
The issue is described here and is caused by the way sending is implemented in Http(s)URLConnection class.

Please add explicit call of e.g. getResponseCode method after calling connect here, probably in FcmResponse constructor.
If adding it is not OK for some reason, please add info about this to README.

AndroidNotification Tag key incorrect

AndroidNotification.java line 50 reads
return (AndroidNotification) addAttribute("sound", mytag)
should read
return (AndroidNotification) addAttribute("tag", mytag)

Web Push notification

Hi - thanks for this repo. It is very useful for me for android push notifications. Since FCM can be used for web push notification as well, I was wondering if this library could be used for that as well. Since it needs a server key, and the project in FCM seem to have only one server key, I was not sure how to use it for Web push. Pls throw some light on the same, as am bit new to this. Thanks for your help.

Singleton not thread safe

The singleton pattern is prone to synchronization errors and is not thread-safe. If multiple thread mutate the state of Push Raven, it will lead to an inconsistent state. The library is really great and I would like to contribute in it after some discussion over design patterns are done

I think we can achieve simpler syntax with production level design with minimal impact on current API

Target User Segment?

Dear developer, is it possible to target the user segment, like it can be done from the firebase website?
Thank you so much,
Roberto

StackOverflowError upon component initialisation

Problem

Hey! So if one follows the tutorial and inits the component like this:

Pushraven.setAccountFile(new File("service_account.json"));
<...>

Then the app enters an infinite loop and eventually crashes with a SO error:

Exception in thread "main" java.lang.StackOverflowError
	at us.raudi.pushraven.Pushraven.setAccountFile(Pushraven.java:36)
	at us.raudi.pushraven.Pushraven.setAccountFile(Pushraven.java:36)
	at us.raudi.pushraven.Pushraven.setAccountFile(Pushraven.java:36)
       <...>

Cause

That's is due to an infinite recursive call here:
https://github.com/Raudius/Pushraven/blob/master/Pushraven/src/us/raudi/pushraven/Pushraven.java#L36

Fix

At first glance, that recursive call seems superfluous, and can be just removed. Right? ๐Ÿ˜‰

Best,
-Dmitry

Cannot find putAll method

Hi,
have you made an example or a tutorial?
Because when I add your Notification.java class I get an error which says that JSONObject.putAll method doesn't exist.

Which version is the latest?

I check in maven, 1.1.0 is the latest. It is kinda confusing. Please advise.

in the version 1.0.1, it throws me this error:

Caused by: java.io.IOException: Server returned HTTP response code: 411 for URL: https://fcm.googleapis.com/v1/projects/olemojo-demo-fire/messages:sendResponse Code: 411

java.io.IOException: Error reading credentials from stream, 'type' field not specified.
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.fromStream(GoogleCredential.java:254)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.fromStream(GoogleCredential.java:226)
at us.raudi.pushraven.Pushraven.getAccessToken(Pushraven.java:132)
at us.raudi.pushraven.Pushraven.push(Pushraven.java:78)
at com.mojo.controller.PublicController.testPushRaven(PublicController.java:91)

Efficient usage in multi-thread application

Hi,
I want to use this library in a web application ( in server side ) which is multi-thread. I need to send multiple notification in same time and i want to reduce creating new objects.
How should i use Pushraven object in this case?
Pushraven object is not singleton, am i right?

Notifications not sent from Google App Engine backend

Hello,

How can you see whether or not the message was sent and acknowledged properly? The integration works as we are able to send messages directly from the firebase messaging page. However, we do not get any messaging while trying to send messages from the backend (based on Google App Engine).

How can we troubleshoot this? Is the only way to get this info through Google Play Console? If so, is it mandatory to publish the app or there is any other way around?

Thanks.

Can't get errors from getErrorMessage()

When I send a deliberately incorrect request, I expect to receive an error. In the logs I see an error. But when I do getErrorMessage() then there is no mistake.

Before the call getResponseCode() I see an error in the debug, but after it disappears

In log:
image

In debug:
image

Issue in sending notification with utf-8 title and body

Hi
Already after sending a notification which has utf-8 title and body ( i test sending Persian characters ), in client side characters are not encoded correctly.
I modified a part of code in Pushraven class and i fixed it.

// Send POST body
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
			
wr.writeBytes( n.toJSON() );
			
wr.flush();
wr.close();

changed to:

 // Send POST body
con.setDoOutput(true);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(wr, "UTF-8"));

writer.write(n.toJSON());
writer.close();
wr.close();

 wr.flush();
wr.close();

Can't receive message on iOS

Hello, I created a firebase account and I am trying to send notifications to both (Android and iOS devices) but only Android is working. Is there any special step to work on iOS too?

Maven publication?

I'm happily using this lil lib in production, works nicely, thanks! Any plans for Maven publication though? It makes deploying to platforms like Heroku much easier - I'd prefer not to have to commit your jar into VC.

Max

i have a question to ask

if i want send a message by the app package to broadcast .how can i do it?
whether it can send meessage only to ios or android ?

how to use .addAttributeMap(key, map)

Hi there,

can I know how to use .addAttributeMap(key, map)?

//my code
Map<String,String> map=new HashMap<String,String>();
map.put("name","Amit");
map.put("abc","Vijay");
map.put("haha","Rahul");

	Notification not = (Notification) new Notification()
			.title(applicationName)
			.body(notificationBody)
			.addAttributeMap("extraField", map);

I got this error:
Error Message: '{ "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name "extra_field" at 'message.notification'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.