Android Question Help With Permissions and running a background app

MrKim

Well-Known Member
Licensed User
Longtime User
I am trying to resurrect an old app that died many years ago when permissions and rules for running apps in the background changed.
I have been reading about this stuff until my head hurts. I am more confused than ever.
Here is what I need to know perhaps someone can point me in the right direction to achieve this.
I need the following information which I used to get by running in the background and monitoring but perhaps that is no longer the best way. Perhaps just reading logsis better?
Date/Time of last unanswered phone call.
Date/Time of last unread Texts.
Date/Time the user last opened/unlocked their phone.
Ability to play a sound in the background.
Basically this app just plays a sound at an interval specified by the user if they have missed a phone call or text.
The assumption being that if they open their phone then they are aware that they have unread texts/missed phone calls so the alarm is turned off.

Thanks for any help/ideas
 

peacemaker

Expert
Licensed User
Longtime User
Does it mean that only the system apps can provide such functionality ?
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
It is not really possible to create such apps with newer versions of Android.

You will need to have a foreground service that runs forever. Most devices will kill the app at some point.
Start with this example: Background location tracking
I looked at that but I got stuck on this line in the manifest.
B4X:
SetServiceAttribute(Tracker, android:foregroundServiceType, "location")
I am not sure how to modify it for my needs.
If I do this:
1. Can I get a notification that the user has unlocked his phone.
2. Can I read the phone logs to determine when the last unanswered call was received.
3 Can I read the SMS logs to see when the last unread text was received.

If I can do these things then I will figure out how. I would just like to avoid doing all of the monkeys and typewriters work only to find it is not possible.

Thanks for your help.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
where it says "location", change it to "dataSync"
1) yes
2) yes
3) yes
 
Upvote 0
Top