Push FCM Xamarin like WhatsApp background - xamarin

I have a problem on Devices Xiaomi and Lenovo Phones, when i close app from task manager they stop receive GCM messages, the gcm messages receive only at foreground and app on task manager list. How do i to keep app or service running on close at task manager? Obs: samsung phones keep as well on both cases.

As stated in this thread, Lenovo mobiles are using Background task killer to stop background apps. To hide task killer, untick restrict in application menu.
Also, as mentioned by #AL. in this post, it may very well be possible that when an app is stopped from multi-task tray in that device, it is actually killing the app, causing the services and other background processes associated with it to also be destroyed. Suggested action is to make use of the START_STICKY flag.
Another reference which might help.
In Xiaomi phones, they whitelist or blacklist an app based on certain criteria. If you download an app and if it is in their whitelist, they'll permit the app to show notifications. If not, you already know what happens. But the good thing is that you can change these settings. Look for an app named Security. If you revoke the right permissions, even WhatsApp will stop showing notifications.

Related

Windows 8.1 Universal App Multitasking Foreground-Background Cycle

Is there a way to know if the app is sent to background or brought to foreground. I don't mean Suspended and Resuming events.
For example, user leaves the app to check something on Facebook app for a min. And then return to back to my app. So suspention doesn't take effect on this scenario. Then how to know user is back to the app on app.cs level?
As stated in the MSDN documentation:
Your app doesn't receive an activation event when app visibility changes, because the app is still running. Windows simply switches to and from the app as necessary. If your app needs to do something when the user switches away and back, it can handle the visibilitychange event (for HTML) or Window.VisibilityChanged event (for XAML).

Windows phone notification that stays till user checks

I am new to windows phone app dev. I want to know if there is any way to have a notification alive till the user checks it. I found that "toast notification" expires in 10 seconds irrespective of user checks it or not. And there is no way of finding out if a tile notification arrived or not. Is there any workaround? I want to have notifications that are similar to Android notifications which stay till user checks them.
Persistent on-screen notifications on Windows Phone are not possible, by intentional design. It's interesting to see how many users on Android disliked persistent notifications when applications started to interrupt and then disrupt the current foreground application experience.
The design philosophy is that they distract from the user experience and could be easily abused by applications.
The general Microsoft recommendation for the platform would be to use a combination of a notification, Live Tile (reference), and in application UI update.
In Android 4.3, the behavior was changed to highlight applications that were constantly running (interesting reference)
You can use "MessageBox.Show(String)".
Refer below for:
MSDN Doc
Example 1
Example 2

Windows Phone 7 push notification when the app is not running

I am trying to implement push notifications in windows phone 7.5
I bind the channelUri in App.xaml when the application starts up.
I can then switch my app to background and receive toast notifications based on the Uri.
But this requires me to first go the app and then make it to background.
Can I receive the toast without the app running? That is when the channelUri is not bound.
Is this a default behaviour in Windows phone 7 or whether I am missing a point here?
If this is the behaviour, how can I send some form of notification/ information to the phone when the app is not running?
I did see this Windows Phone 7.5 - Push Notifications when app is tombstoned.
Update:
I know the Channel is active up to 30 days, is it the same when I use only emulator?
App should be associated with a channel so as to receive notification and even when app is not running, if the notification channel is active, then the application will receive the toast
I think you are missing the point. In order to receive toast notifications you don't have to have the app running in the background. Toasts (and Tile notifications) are meant for when the app is not running at all. So, start the app to get a push-uri and then send that to the service. In theory you won't need one again after 30 days. When it comes to the emulator it will be available as long as the emulator is running. Once you shutdown/close the emulator, the push-uri is gone and you would need to re-request one. (Generally speaking, nothing is saved on the emulator and so closing and opening the emulator is like getting a new device everytime.)
Hopefully this helps

How to run a WP7 silverlight application after some period of time?

I have an application in WP7 silverlight that needs to be launched after a specific period of time, something like an alarm.
But I want to launch the application itself not WP7's alarm.
I use:
this.Visibility = Visibility.Collapsed;
for hiding the application, I know it is not the correct way for making it run in the background.
Any hint please? Thanks.
The platform specifically does not support running apps in the way you describe.
If your functionality can't run in a background agent then your only options are to use an alarm or toast message (sent as a push notification) to prompt the user to start the app.
One of the design decisions behind the platform is that the user should always know what is going on on the phone so having apps stop and start by themselves would be contrary to this.
You can run a background agent and display a toast notification to the user , and launch the application when the user clicks on the toast.
You can also push toast messages to the device, and rely on the user clicking the toast .

windows phone app running in the background

Is it possible to create an app the runs in the background? If so is there any samples out there for this?
In Windows Phone OS 7.1 you can actually use Background Agents now to perform tasks in the background.
from MSDN:
Scheduled Tasks and background agents allow an application to execute
code in the background, even when the application is not running in
the foreground. The different types of Scheduled Tasks are designed
for different types of background processing scenarios and therefore
have different behaviors and constraints.
You can use a PeriodicTask or ResourceIntensiveTasks. Read more about it in the MSDN article above.
And here's some sample code for you to integrate background agents into your existing app.
Sample Code: Background Agents in Mango
An application in the foreground can continue to run when the phone screen is locked(not background but...) by setting the PhoneApplicationService.ApplicationIdleDetectionMode property. By setting up your application to run when the phone screen is locked, a user is able to access the application quickly upon unlock. However, when your application runs under a locked screen, it could consume power outside of the user's control. For this reason, your application must minimize power usage when running under a locked screen
At the moment there is no way to create application that runs in background.
True multitasking for 3rd party Windows Phone 7 apps will come as an OS upgrade later this year. However, unless the app has to absolutely run in the background (like Pandora etc.), we as developers share some responsibility in making our apps feel at home with the rest of the OS.
Windows Phone OS offers app developers chances to save state of their applications to give the end users the feeling that it never stopped running; this is essentially the same as in other mobile platforms. As your app is being deactivated/closed, you have the option to "Tombstone" your state so that your users can come back to just where they left with BackStack navigation or future launches. Channel 9 had a nice set of demos & labs around tombstoning, found here.
Hope this helps!

Resources