How to send Push Notification using OneSignal in Android Studio - android

I've followed the guide in OneSignal's documetation, i've setup the sdk and everything, yet, sending a notificaion through code seems to not work at all, not by a specific tag and not by "All Users" segment example which OneSignal provided in their documentation.
Tho, through their dashboard- it works perfectly.
I've doubled checked all the grandle setup part and stil...
Any idea why that can be happening? what should I check next?
(I didn't attach my code here cause it's an exact copy of OneSignal's code in their documentation)
Thank :)
EDIT: i've noticed that when I send push notification through code- it isn't being shown in the OneSignal's dashboard. So it means something is wrong with the code, tho again, it is similar the the one inside thier documentation (except that i've changed there the ONESIGNAL APP ID
and REST API KEY, as they requested).
Any ideas? tnx.

Related

Firebase console - problem receiving test push FCM notification in android device

I am sending push notification using firebase console and i am getting "0% of potential users are eligible for this campaign: 0". and push notification is not displaying in mobile..If anyone got same experience and solve issue then please suggest me how can i solve this issue. I followed all the thing..that i added json file that i got from firebase.
Please check for the following:
Have you configured your android package name correctly.
Did you place the google-services.json file in android/src folder.
Make sure you have done all steps present in this link (If you using android studio i suggest going with option 2)
Get user token to send firebase message Follow the steps
After all these if you still can't receive push notifications try setting channelid in advanced messaging options
Refer https://firebase.google.com/docs/cloud-messaging/android/client link step by step and you will be good to go for your push notification using fcm and if you already implemented the basic things then compare your code with the sample code step by step mentions on the link. you must find out the error. let me know if it resolves your issue.
Go to Build --> clean project -->Rebuild project
(Build is at top in android studio)
Why it was not working - You must have had deleted google-services.json file and re-added it.
Make sure you have only one firebase project configured for this app (if no then delete one you dont plan to use)
Go to firebase setiings -> Left top angle -> settings icon -> Project settings ->
scroll to bottom, then make sure to add SHA certificate fingerprints Type. How to get it
Then (still on this page) press See SDK instructions button. And place google-services.json file in your project.
If all this steps passed for you and you still getting this error then just wait a little bit, for me it take 2 days, before it started working.

Amazon Pinpoint and Ionic - Push notifications not working when app is in background

I was asked to develop a sample app integrated with Amazon Pinpoint. Since I am not a pro at developing apps, I decided to follow this simple tutorial and develop the app following the steps described in it. The only differences are that, instead of using an emulator, I executed the project in my own cell phone (a Xiaomi Redmi 4x) and instead of GCM, I used Firebase.
At first, it seemed to work perfectly, but when I moved the app to the background and went back to my homescreen, I could no more receive push notifications from my app. When the app is open and running, everytime I send a push notification a pop-up appears with Title "New Notification" and buttons "Ignore"/"View". But when in background, nothing is visible in my system tray!
Also, if someone knows which part of the code is responsible for this notifications, just warn me and I upload it here.
Okay, so after some tests I made it work (not through console, but through CLI). To do so, I followed some steps I found this question, that took me to two other documents: one from Amazon teaching how to send push notifications through CLI and a simple but very detailed tutorial of phonegap-plugin, the plugin used in our Ionic application to process the pushes.
First of all, replace the phonegap-plugin in your app with the master version avaliable in the github link I sent you.
Then, putting all those information together, I figured out how to write a .json file containing the information we need to send the pushes. Here is a sample of the code I used:
{
"MessageRequest": {
"Addresses": {
"YOUR_DEVICE_ADDRESS_HERE": {
"ChannelType": "GCM"
}
},
"MessageConfiguration": {
"GCMMessage": {
"RawContent": "{\"data\":{\"title\":\"StackOverflow rocks!\",\"body\":\"Am I right?\",\"actions\":[ { \"title\":\"Yes!\", \"callback\":\"app.yes\", \"foreground\":true }, { \"title\":\"No!\", \"callback\":\"app.no\", \"foreground\":false }]}}"
}
}
}
}
As you can see, to change the content in the push notificationm, you'll have to edit it's "RawContent". To do so, use the phonegap-plugin tutorial I sent you and find out how to do the alterations you wish.
Last step: once you updated your plugin version AND saved the code above in a .json file (let's call it test.json), you can send it to your phone oppening command line in the folder containing your .json and writting:
aws pinpoint send-messages --color on --region YOUR_SERVICE_REGION --cli-input-json file:///test.json
This should do the trick! Hope it works for you. If any doubts, just let me know!

'Cannot read property 'listRegistrationsByTag' of undefined' from Microsoft.WindowsAzure.MobileServices.Push.RegisterAsync

This is a Xamarin.Forms app running on Android, based on the Azure getting started Mobile App example.
I'm trying to register a device's id for notification services. Originally I was getting unauthorized, so I relaxed authorization settings on the backend. Now I am getting this error and cannot find a reason why.
I checked and double checked that notification hub has the correct Firebase details that align with the app and cannot see what the problem is here, any help appreciated.
John,
If you set WEBSITE_PUSH_ENABLED=false in your appsettings, does the problem go away?
Can you check your Mobile App's app settings?
Specifically, I am looking for the existence of the app setting "MS_NotificationHubName". If that app setting doesn't exist, you need to add it, with the name of your notification hub.
There is a bug in the Azure App Service Push blade right now. A fix is being rolled out. In the interim, instead of using RegisterAsync(), use the method described in the book http://aka.ms/zumobook - chapter 5.

Scringo Facebook , app id logcat issues , Facebook login works with Parse SDK not with Scringo

I use parse sdk and scringo in my app , parse works fine for my login with facebook so app_id is set correctly , but when login via scringo it just shows please wait
any help !!
Logcat
Scringo(11060): You need to set the facebook app id in the manifest. See https://developers.facebook.com/docs/tutorials/androidsdk/3.0/upgrading-from-2.0-to-3.0/#login
how to go ahead with facebook sdk and scringo , the site is not informative and even the api docs dont explain much , no reply over email so i have to turn to SO for help
EDIT:
I use broadcast receiver now as per their guides , how to login correctly
http://www.scringo.com/docs/android-guides/popular/handling-login-status-changes/
What you're describing is a problem common to all Facebook libraries, you need to create an application on Facebook and get an id/key (http://www.scringo.com/docs/android-guides/popular/connect-to-social-networks/), most libraries then require that you set it in the manifest. I haven't used this library, if you want to try using https://github.com/sromku/android-simple-facebook I can provide more help (if you need it, Simple Facebooks guide is pretty good), otherwise this hopefully makes it clear what you're missing
According to their quick start guide, Scringo it turns out also has it's own App Ids which you get through a dashboard, take a look here: http://www.scringo.com/docs/android-guides/quickstart/
I had the exact same issue.
I fixed it by adding my scringo app id in the scringo.properties file under the assets folder of my project:
scringo.app.id="your_scringo_app_id"
Hope it helps.

Rich push in Urbanairship in android

I am implementing Push Notification for Android in my project. I am implementing urbanairship GCM push Notification.While i gone through the urbanairship site, i camr to notice that under the messages tab, there is an option for "TEST RICH PUSH". I have already done tested simple push by sending push messages from "TEST PUSH" under the tab messsages. Now my question is in "TEST RICH PUSH", there are two new fields "USER" and "ALIAS". Is Rich push is used for sending push notification only to a particualar user currently using an App. or it has got any other purpose. Also please let me know how to enable "RICH PUSH" in their new website.(Earlier it is staright forward. Now i looked in their whole website, But i couldn't find a clue). Any help in this is highly appreciated.`
Thanks InAdvance
Rich Push is automatically apart of the Urban Airship library (at least since 3.0.0 version, probably before then as well but I'm not sure which version number). There are just a few things in code you have to do to get it up and started.
In your airshipconfig.properties file add the line "richPushEnabled = true" (without quotes).
In your manifest file add a service with the name "com.urbanairship.richpush.RichPushUpdateService" along with the PushService/PushWorkerService, etc.
And you should be good to go! If not let me know I may have forgotten something.
To send a push you have to use the curl command found here (Under Rich Push -> Rich Push broadcast): https://support.urbanairship.com/customer/portal/articles/1069013-helpful-curl-examples under audience instead of doing "all", spit out this value to the logs somewhere once UA is initialized: RichPushManager.shared().getRichPushUser().getId() (import com.urbanairship.richpush.*;) and make sure the MasterSecret parameter is NOT your api secret but the master secret found in your API keys on your UA developer dashboard.
I wrote everything out because Urban Airship's documentation DNE for android Rich Pushes, it's absolutely horrible. They have a sample project but that's it.

Categories

Resources