Doze mode on Oreo - java

I am facing issue in my app regarding doze mode. I am making a chat application and when app is in backgroud during doze mode and receive any message . Device does not show notification in orea.
I have followed the proper procedure for OREO notification by building channel for it.
I need to find if there is a way to whiteList my app from doze mode so that I can have notifications. Or any other process to optimize notification building.

I do not need to whitelist my application to get notifications in doze mode. I recommend to look at your notification to see if you can find the issue there.
Some tips:
Send a notification, use the notification field. If theres no notification field it will be handled as a data notification. Data notifications are delivered when the app starts again.
Set priority to high.
Maybe use time to live = 0. That will make firebase to try harder to get it delivered. But it will be lost if it fails.
Hard to give you more direct advice when I do not know where you are sending the notification from.
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages

Related

OneSignal push notification doesn't wake up android

I'm making a push notification service using OneSignal API, the problem I stuck at is following : Notification is being received perfectly, but it doesn't wake up my android phone. As i searched in documentation, for IOS, you need to pass content_available : true, to wake it up, but what for Android? Are there something else i need to pass, to wake it up? Using nodejs and express as server. Thanks for answers :)

Sending message from Android host device to wear when app is not running

I'm building a simple motivational quote app that generates a random quote from a MySQL database. The app works fine on mobile and I want to sync the quote message to a Wear device. I'm using MessageApi to do so and used this tutorial to set it up: http://android-wear-docs.readthedocs.org/en/latest/sync.html.
However, the message functionality only works when the app is running on the host device. I need to launch the app on Wear alone and still be able to receive the message from the mobile device. I thought of running the same application on the Wear device where it will run an httpconnection on it's own but from what I understand this is not possible with Android Wear.
So my question is, is there a way to open an app on a Wear device that will trigger the mobile app to open in the background and hence receive the message that way?
Your mobile app can implement WearableListenerService. In that service implementation, you can listen to messages that are sent to your phone from your companion app on a wear device (when such message is sent to your phone, the framework on your phone starts up your service and passes the message to it). You can then implement the logic you need in that service (fetch a quote, etc) and respond back to your wear's message; when its work is done, that service will go away on its own. For this to work, your wear app needs to send such message to your phone app upon start up (or whenever you see appropriate in your app). This approach should work and probably is the most appropriate approach for your use case.

Can we distinguish Blackberry is in USB mode or charge mode?

I am new to blackberry-7. In my application when I plug my phone into the cable (by means of the USB cable) I want to find if my blackberry connected with USB is in charging mode or transfer mode. How is it possible?
The USB can be detected asynchronously using SystemListener2 and also synchronously using DeviceInfo.getBatteryStatus.
For what you need the battery status won't work because it probably charges in both normal and transfer modes, and then there's the problem of detecting the cable when the battery is full. So I'd try registering a SystemListener2 instance and hopefully the callback usbConnectionStateChange will be passed the flag SystemListener2.USB_STATE_CABLE_CONNECTED as argument. When it is transferring, I'd expect the flags USB_STATE_ENUMERATED and USB_STATE_MS_INTERFACE_ENUMERATED to be received in the callback as well, but I've never tested it on a real device.
And I don't know what would happen if the device is already connected when the listener is registered.
To register the listener, call
Application.getApplication().addSystemListener(mySysListener2);

What about ios push notification disabled for my app?

I'm sending push notifications on devices in Java with Javapns.
When a user uninstalled my app and I send a push to him, I'll find this user in the feedback service, that's ok.
But how it works if the user disabled my app notifications ? How can I know it on server side ?
The app can know it (with UIRemoteNotificationType) and warn the server with a get/post but is there a way to know it on the server ?
The doc isn't clear enough about push notifications sent and user deviced push notifications disabled
You can not. Except for the feedback that you described, you will know nothing. Even if the user installed your app and enabled notifications, it may never get the notification and you won't know about this.

Start Application when Pushover notification has received

i create an application on my android device and i want run it when i receive a pushover notification. After i want passing the notification's text to my app. Is it possible?
thanks a lot
You make an application which subscribes to the notifications using
NotificationListenerService in Android 4.3 or Accessiblity Events in older versions of Android. See the following SO Answer for more information.
Also see the following example.
Then in either onNotificationPosted or onAccessibilityEvent your application should triggger your other application to launch using the method described in this SO answer.
This would allow you to start an application when any status bar notification was received from PushOver, and by filtering it to only notifications related to a new pushover notification, you would start an application when a new pushover notification was received.
In order to have the notifications text passed to your application or to filter based on the specific contents of the notification, you would need to subscribe to C2DM pushover messages which is protected by signature level protection, so without consulting the creators of pushover I don't believe that is possible.

Categories

Resources