For my schoolproject I have to develop an Android app that continuously tracks the owner of the phone and let him track the phone when lost.
For this kind of app I need to start the app in the background whenever the phone boots.
I was wondering how I could do that?
And perhaps you have some ideas of all the sensors I could use to track if the owner is near the phone.
Thanks!
Use BroadcastReceiver to start somthing on the boot completed.
Related
I have developed a react-native app for Android to receive real time food orders (like Uber Eats, Postmates, etc.). The app is running in a Lenovo tablet that is constantly charging. I use a GraphQL subscription to detect new orders and Firebase Cloud Notifications to check the network status of the tablet.
The problem is that right now the system eventually kills the app after some days with no interaction. I would like to know the best approach to prevent the systems kills the app and being able to run it 24/7 in this case scenario.
Thanks!
You should write a service for your app, which starts the app when it gets killed.Never ending service has a good tutorial on how to do this.
I am working on my app and i am developing android anti lost app. So how can i make a service that will capture image or record voice even when device is locked ,I have figured out how to trigger that service.
But how to write code that will do the job even if device is locked?
For making an anti lost app the service must run the whole time . I don't think that lock screen will affect the workings once the service is on still you should try using PowerManager class with permission android.permission.WAKE_LOCK.....
refer to https://developer.android.com/reference/android/os/PowerManager for more details
for camera you can refer to https://www.javatpoint.com/android-camera-tutorial
for voice recorder you can refer to https://www.tutorialspoint.com/android/android_audio_capture.htm
I read this unable to detect shake event when my phones screen is off in android article. But this question is differ from this.
I created an application which speak (using TextToSpeach API) time when I shake device. For that I have created a "Service" in which "ShakeListener" was registered. While I shake device, it will speak current time.
But this works fine while my device is "ON". When I lock my device, it stops working. Can any one elaborate what is the problem behind?
I think the problem here is that when you lock the device, it goes to sleep mode. And your ShakeListener doesn't receive shake events. The best way to implement what you want would be to register broadcast receiver to receive shake events. But as I know, android doesn't provide such broadcast. Another solution is to acuire a partial WakeLock. It'll prevent android from sleep. But of course it'll cause battery issues. Also take a look on this thread: Android accelerometer not working when screen is turned off
Probably you can not receive this notification until you patch some kernel implementation. Android doesn't broadcast such notification.
I am working for an company witch wants to give employes devices that can track them using gps. I want to create a service that won't close in task manager.
Is this possible ?
Your best bet would be implementing a System Service on the device. These are apps which are started on boot and stopped at shutdown. The user won't be able to stop these.
However you will need rooted device with modified Android OS software.
http://ofps.oreilly.com/titles/9781449390501/Android_System_Services.html
I don't think its possible. Any non-system process/app running in android can be killed/stopped. Your best bet would be to restart that service in case it got killed.
From ICS onwards, any app implementing Device Administration cannot be stopped. This is being done for specifically for enterprise customers to have this option. Further you do not even need root access for this.
i want to get the event when mobile is switched on in my application.
so, how i handle/get switched on event of mobile in my app, is it necessary to run my app in background?
can anyone help me?
Thanks in advance.
Have a look at the discussion in this thread:
Is it possible to write an Android broadcast receiver that detects when the phone wakes up?