How to start foreground services without notifying user. How every other apps like whatsapp, instagram and other can use it without notification - foreground-service

well answer is here
They are deleting the channel id that's why notification of foreground service will be never displayed.
Here is the code to do it.(Simply paste in your main activity).
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationManager.deleteNotificationChannel(/*Your channel ID*/);
}
Hope it helped you to counter the notification of foreground services it worked on my device android 11.

Related

How to reload gmail add-on through background process using app-script

May i get some help on the below points where i am using app-script to develop a gmail add-on:
How can we refresh gmail add-on with back ground process?
=> Here is my case, I need to display card with multiple sections which is the process of hitting multiple apis to fetch data and to display the card. For this initially we will show a card with minimal information to the user once i get information from api, i need to update the basic cards with complete information.
How can we trigger a function on every mail thread open?
=> Currently it works once for a mail, here as explained above point need to refresh a card once we fetch the data. If not, user will be seeing same basic information card every time he opens the mail.
From above mentioned issues for point one we are trying to get solution where we can hit service for certain interval of time to check data availability and if data exists then fetch data and update cards, i mean to say need a setTimeout function kind of thing, unfortunately we did'nt found this in app script and We found sleep/waitLock functions in app-script, but my services may take little time to fetch data as it connects though multiple services so we cant make the user to wait until the whole process is to be completed. So that we will show a card with basic information required then after need to auto refresh the cards once we fetch the data. we tried of keeping refresh button for the user to click and fetch the updated data but here we are losing user experience, trying for auto refresh with out user interference to get updated information.
Need a process / solution where we can auto refresh the card with out user interference after the data available at our end instead of making user to wait until the process to be completed.
Earliest reply will be more helpful for us.
Thanks.
If a data status on a third-party backend changes as the result of a user interaction with your add-on UI, it is recommended that the add-on set a 'state changed' bit to true so that any existing client side cache is cleared. See the ActionResponseBuilder.setStateChanged() method description for additional details.
The card-based interface in Gmail Addons is an Apps Script Service.
You can interlink it with other Apps Script services as well as implement API calls - everything within the same Apps Script file.
Gmail Addons contents automatically update every time the user opens a different e-mail or refreshes his browser.
Within your Apps Script code you can install time-driven triggers to run the data availability check with a customized frequency.
Consider to install for your users an Auto Refresh extension if you do not want them to refresh the card themselves.

Push notification not getting delivered via service workers

We have deployed the chrome service worker on our website in July 2015 and have over 380K active subscribers of which over 90% are mobile devices.
But we are encountering issues with the service worker. When a user's cache gets cleared or when many of the mobile apps like cleanmaster and other utility apps on a phone clear cache on a user's mobile. In that case we do not have any access to device token of that user. And hence even with 380K active users for which google sends us message ids we only get 50K impressions which is a very low ratio.
Our push notification subscription is implemented on a seperate subdomain as we could not make the entire site https then.
I have 2 queries:
We would love to know if Google is working on setting up a canonical system (Which is there in GCM for mobile apps) through which even if the user's cache gets cleared via these apps he might be able to get push notifications. Our users have complained again and again that even after subscription they are not receiving push that's when we went deeper and figured this out.
Also is there a way through which we can ensure we get back those users ?
When a user clears their cache in Chrome, it also unregisters service workers and clears the window cache as well. By unregistering the service workers it will unsubscribe the push subscriptions.
I agree that it's hard to understand the link between clearing a cache / cookies and how that relates to service worker and push notifications from the UI - the Chrome team are aware of this.
The best advice with respect to getting those users back is to ensure that when ever a user enables notifications and you get a subscription object, keep track of that decision as their last known decision and when the user re-visits your site, if they should be subscribed and you have permission, you can get a new subscription and send that back to your server.
Update
I put together this blog post: https://gauntface.com/blog/2016/05/01/push-debugging-analytics
Looking at your site there are a few issues in your code:
it seems that you have several broken promise chains and and overall it's hard to reason with what is going on in the push event, I'd strongly recommend tidying it up.
There is a minor but obvious bug when the service worker start ups and tries to examine the push subscription, which doesn't exist.
You are registering two service workers but only one of them gets used for push.
Checkout the blog post above, it covers how I came to that conclusion and some advice on how to fix it.

Launch 2 SMS Compose tasks in Windows Phone 8.1 RT App

I have a button in my Windows Phone 8.1 RT app. When the user clicks the button, 2 SMS are supposed to be sent to two different users.
I can launch one SMS Task using the following code
var message = new ChatMessage();
message.Recipients.Add("1231233");
message.Body = "This is a text message from an app!";
await ChatMessageManager.ShowComposeSmsMessageAsync(message);
But when I do this multiple times, the app crashes. The Task complete event fires on task launch, is there a way to know if the user has returned to the app after sending SMS so the next one can be fired?
If the ShowComposeSmsMessageAsync is anything like the MessageDialog.ShowAsync method, which seems true as both return IAsyncInfo objects (..Action/..Operation is different, but the async part is important for us), this problem could be solved like the problem of showing multiple message dialogs. A quick search yielded this question, with multiple correct solutions: How to allow for multiple popups at once in WinRT?
If the above doesn't work, you could - for example - subscribe to the VisibilityChanged event of the app Window (https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.window.aspx), as it should provide you with an event about the user returning from the sms task.
So basically 1. subscibe to event, 2. send 1st sms, 3. wait for event, 4. send 2nd sms.

Fast App resume not working under password lock screen on windows phone 8

I have implemented Fast resume in my windows phone 8 app and its working fine in every case except following scenario.
Steps:
1)Phone is password locked
2)Toast is received.
3)Tap on toast.
4)App is activated.
5)The page which was last on backstack opens up with reset state.
6)No more navigation
In Fast Resume app should receive one more navigation with deep link on tapping on toast which is missing in this case.
Please find sample here.
This feature of Windows Phone. If the reminder or toast to send from your lock screen (even without a password), the navigation application is limited. I think that there is no way now to fix this behavior ...
I got even more unpleasant situation with reminders of the applications:
1) If screen is not locked and you gave a reminder of the application, then click on the reminder will open the application, you can immediately take action in response to the reminder. All well and good.
2) when the lock screen (even without a password) and you send a reminder of your application, there is no ability to navigate the application by clicking the reminder. Reminder, you can only cancel or postpone for a while. Then the user must unlock the screen, open the program and try to understand what to do in response to this reminder.
At least toast is displayed in the notification center, and the reminder disappears without a trace and the user attempts to find what caused the reminder.
I do not understand why such inconvenient behavior for user application communicates with the lock screen.
Wrote a post on UserVoise, but without response.
Enable to open a task or an appointment directly by tap on the reminder

How to trigger a "flyout, dialog, app bar or other inline element" if the phone receives a notification while the app is closed?

I'm working on a Windows Phone app that will receive push notifications and needs to show critical alerts to the user. As far as I can see there are 3 types of push notification:
Raw Notification - Raw notifications are used when your application is actually running on the device. This allows you to
update your interface “live” as the user is using it.
Toast Notification – This message will be received regardless of whether your application is running or not, but popping toast messages
while your app is running might be a little annoying. I’ll
demonstrate this example below. Toast WILL NOT also update your
application’s data. You still need to pass a Raw Notification to make
this happen.
Tile Notification – If your application is pinned to the user’s Start screen, you can update the Tile for your application. You can
change the background image, as well as an integer from 0-99.
source: http://www.jeffblankenburg.com/2010/10/19/31-days-of-windows-phone-day-19-push-notifications/
These each have different behaviours, but none lend themselves to critical notifications, where the user can be actively alerted to critical information.
Having read Guidelines for toast notifications on MSDN, it suggests
Don't use toast notifications to notify the user of something that
must be seen, such as a critical alert. To ensure that the user has
seen your message, notify them in the context of your app with a
Flyout, dialog, app bar, or other inline element.
So the question is, how can I trigger a "flyout, dialog, app bar or other inline element" if my app is closed and the phone receives a critical notification.
long story short: you can't enforce that your app opens on an incoming pns
But I think you've got the toast scenario wrong. A toast can be used to notify the user, if he taps it the app opens and you might react to that by the navigation uri (e.g.: ?fromToast=true).
If you receive a toast notification while your app is open the toast won't show. Toast Notifications only get displayed when your app isn't open. But you can react to an incoming toast notification (there's an event for that) to implement an behavior of your way (e.g.: flyout, msgbox, ...).
note: introduced with GDR3: The sound of the toast notification can now be changed (even made silent).