How to use uniqush on Android?

385 views
Skip to first unread message

Danial RikhtehGaran

unread,
Feb 29, 2016, 7:46:48 AM2/29/16
to uniqush
hi i want to send a push notification message to an android app but i can't find any tutorial to use uniqush so i say all steps i have done.
1. first install uniqush on my server so when i run this command then i recevied:
uniqush-push 1.5.2


2.Then i go to https://console.developers.google.com and make a project with details :

3. Then i make an api key for  Google Cloud Messaging

4. Enable API and get an api key:


5. Now i run this command and put api-key and project number:

curl http://127.0.0.1:9898/addpsp -d service=myservice -d pushservicetype=gcm -d projectid=mypush-1215 -d apikey=AIzaSyD9Jt0K7ksG3FV4fCyYnQSyzDT7KMN2LaA


6. Then register device:
curl http://127.0.0.1:9898/subscribe -d service=myservice -d subscriber=uniqush.client -d pushservicetype=gcm -d regid=fakeregid

7. Now in android-demo app i put this information:

8. It's compile but it returns this error:

02-29 12:35:52.589 6863-6863/com.monnand.uniqush.demo E/AndroidRuntime: FATAL EXCEPTION: main
                                                                        Process: com.monnand.uniqush.demo, PID: 6863
                                                                        java.lang.RuntimeException: Unable to start activity ComponentInfo{com.monnand.uniqush.demo/com.monnand.uniqush.demo.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
                                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
                                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
                                                                            at android.app.ActivityThread.access$800(ActivityThread.java:151)
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                            at android.os.Looper.loop(Looper.java:135)
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5254)
                                                                            at java.lang.reflect.Method.invoke(Native Method)
                                                                            at java.lang.reflect.Method.invoke(Method.java:372)
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
                                                                         Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
                                                                            at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:331)
                                                                            at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:300)
                                                                            at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:264)
                                                                            at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
                                                                            at com.monnand.uniqush.demo.MainActivity.onCreate(MainActivity.java:16)
                                                                            at android.app.Activity.performCreate(Activity.java:5990)
                                                                            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
                                                                            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
                                                                            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
                                                                            at android.app.ActivityThread.access$800(ActivityThread.java:151) 
                                                                            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
                                                                            at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                            at android.os.Looper.loop(Looper.java:135) 
                                                                            at android.app.ActivityThread.main(ActivityThread.java:5254) 
                                                                            at java.lang.reflect.Method.invoke(Native Method) 
                                                                            at java.lang.reflect.Method.invoke(Method.java:372) 
                                                                            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
                                                                            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 


8. Also send message doesn't work:
# curl http://127.0.0.1:9898/push -d service=myservice -d subscriber=uniqush.client -d msg="Hello World"[Push][Info] 2016/02/29 16:07:17 RequestId=56d43b7d--xRrhoPqs4-6BaNCIErXlQ== From=127.0.0.1:54902 Service=myservice NrSubscribers=1 Subscribers="[uniqush.client]"
[Push][Error] 2016/02/29 16:07:18 RequestID=56d43b7d--xRrhoPqs4-6BaNCIErXlQ== Service=myservice Subscriber=uniqush.client PushServiceProvider=gcm:26e1ede09784f3e529bf9f12adfda75538059727 DeliveryPoint=gcm:58888d7d95baccad6d69026f04109e15816e531c Failed: GCMError: InvalidRegistration

So i don't know how to connect this push message to my app which step was wro





Monnand

unread,
Feb 29, 2016, 11:35:48 PM2/29/16
to uni...@googlegroups.com
Hi Danial,

In short: android-demo is not supposed to work with uniqush-push directly.

uniqush-push is a server side program and you can write your client by just using the normal notification framework provided by android.

A long story was: android-demo was a part of my toy project, which will supposed to work with uniqush-conn. However, the whole uniqush-conn system is currently not under development. Our main focus now is uniqush-push.

Regards,
-Nan

--
You received this message because you are subscribed to the Google Groups "uniqush" group.
To unsubscribe from this group and stop receiving emails from it, send an email to uniqush+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maurizio Cainelli

unread,
Mar 1, 2016, 2:39:46 AM3/1/16
to uniqush
If you are using Uniqush just to push notification between Android and not Android to iOs or viceversa, I suggest you to use Google Cloud Messaging.

It's easier because you don't need to install anything on your server since your push notification are going through the google server.
Reply all
Reply to author
Forward
0 new messages