Make app not deliver notifications to Android Wear - java

I have an app I'm working on that isn't yet compatible with Wear. Is there a way for me to block notifications from being delivered to a user's smart watch? The app has a persistent notification that I do not want to display until the wear module is ready.

If your using notification builder, there's an option to setLocalOnly.
Development docs :'setLocalOnly(boolean localOnly)
Set whether or not this notification should not bridge to other devices. '
Notification notification = new Notification.Builder(mContext)
.setContentTitle("New mail from " + sender.toString())
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail)
.setLargeIcon(aBitmap)
.setLocalOnly(true)
.build();
Not tested it from the phone but I know it works with stopping my wear notification appearing on the phone.

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

Android Studio - Insistent Notifications on Oreo w/ Notification Channels

I am currently developing an app where insistent notifications are required. However, I can't seem to get them to work unless the app is open. Is there a way to get insistent notifications connected to the notification channel, even when the app is not open? I'm using a Windows Service to curl the notifications. I'm developing on Oreo. Thank you!

Doze mode on Oreo

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

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.

Display alert notification even app is closed

The app is fetching alert data from server. What I have to do is display the notification if app will get new alert. This should be happen even app is closed. Previously, I have worked on push notification where server is used to display the notification. But here I don't want to use push notification. So is there any way to achieve it?
Use the Notification API. Notification is a message you can display to the user outside of your application's normal UI. When you tell the system to issue a notification, it first appears as an icon in the notification area. To see the details of the notification, the user opens the notification drawer. Both the notification area and the notification drawer are system-controlled areas that the user can view at any time.
You might require a Service to accomplish your needs. Use a Service with the mentioned Notification API to send notifications even when the app is 'closed'.
no other way to this without using push notification and GCM

Categories

Resources