Flutter, Detecting that other apps are launched - flutter

I'm trying to develop an app that prevents a user from starting other application when my app is running. The scenario:
my app starts the timer
app detects launch of another app (could be anything other than my app)
if it detects, it cancels some achievements
Can anyone help? I saw some solutions on this topic, but could not find anything in Flutter.
Any ideas would help.
Thank you.

There is a few ways to do that but easy one to observe your app situation, you can use WidgetsBindingObserver to detect your app is background or not.
But if the case is not being background it is just depending to launch an app so there is a few ways which suggest in this answer you can try them.

Related

Flutter application restart instead of resuming after some time when switch to other applications

Hi i am developing a flutter application and i am using getx statemanagment. The problem is when i put application in background and use some other applications like whatsapp,youtube,play a game or listen music, after some time when i resume my application from recents it restarts and all progress is lost.
I have already tried different solutions like moveTaskToback(true) with native android function call
Please help, I have almost finished my important application.
I'm not sure on why this happens, but some manufacturers have their own restrictions on apps running in the background. Nothing you can really do from a flutter perspective, the app lifecycle is the same on all devices.
Here is a link where they share some tips how to deal with this on Xiaomi from the users perspective.
https://dontkillmyapp.com/xiaomi
From the developers perspective, as you can read on the bottom of the article, the are no common workarounds known yet.

How to get notified about app being completely closed

I need to take an action when my app gets destroyed. I tried to use WidgetsBindingObserver and WillPopScope so far but none of them is invoked in case user removes the app from launcher's recent apps. Is there a way to execute some code before app is completely gone?
As far is I know for now, there is no way in Flutter. But I know a native way in Android (see this link)
You can implement this in your MainActivity or so, see this how to call Android/iOS code from Flutter
I don't know how to do in iOS, but that could be a bit more difficult due to iOS's different app resource handling etc.
Also, it could be a nice idea for a plugin/package. So developers, go ahead ;)

is it possible to continuously track gps location in phonegap app(iphone) in background(means when app is not running)

I am working on an iphone app which needs to pop up a notification when the user reaches some particular place. I am developing the app in phonegap. A function is available in phonegap to track gps location continuously i.e. "geolocation.watchPosition", but I want to know: will the function keep on tracking the location even if the app is not running(exited state)?
I recently came to know that for the desired functionality I have to create a phonegap plug in and embed it to the project. This worked for me.
you can do it if your app is runing in background but its not possible if the user stops the applicationcheck this post Is it possible to run a background process on the iPhone using private APIs?

iPhone app rating popup code

Does anyone know of open source code available to implement a popup to the user after so many days or so many instances of the app to prompt the user to rate and review the app on the app store?
I've seen this already with a few apps I own.
Thanks in advance for your help.
This isn't ideal, i personally find it abit ugly, but it's easy to implement and reactivates when a new version is released and more importantly works.
http://arashpayan.com/blog/index.php/2009/09/07/presenting-appirater/

IPhone launch application with home button

do you know in which ways is it possible to launch an application?
I know that it is possible by clicking on the icon, and it is possible by clicking an url with a cistom protocol,
Anyone know if there ae more ways?
For example is it possible to make an application be launched when the users touch 3 times the home button?
or when the user start a call?
thank you
Paolo
The only ways that it is possible to launch an application are the ways you describe:
Clicking the application's icon
Via a custom URL scheme
The above applies to non-jailbroken iPhones. I would imagine it is techinically possible to hack a jail-broken iPhone to launch apps in other ways, but naturally such functionality would not be permitted on the App Store
Jailbroken phones can use libactivator. It has a set of predefined touch and physical button events that can start an application. Of course it is not viable if you plan to publish your app in the store.