0

I am writing an application for Android >=12, in which I use ForegroundService to get the user's coordinates and synchronize them with the server.

I don't have any apps hosted anywhere yet (I'm a beginner).

When I test my application by installing it from Android Studio, everything is fine - the application is installed, the service is running, the coordinates are saved to the server.

But when I created my signature for the application and installed it on my smartphone by downloading it from the server, the following unpleasant moments arose:

  1. When installing the application, a warning appears that the developer is unknown. And the user is strongly discouraged from installing this application.
  2. My ForegroundService service shuts down periodically at certain times. And it does not restart, despite the "Autorun" setting enabled by the user.
  3. After closing a running service, for example, with the standard MIUI "Security" application when clearing memory, and the subsequent automatic start of the service (the "Autorun" setting is enabled by the user), GPS coordinate detection (FusedLocationProviderClient) stopped working.

After studying the issue, I came across a post that says how to properly organize ForegroundService so that it is not nailed by the system. By executing

adb shell dumpsys > tmp.txt 

, found out that FS is designed correctly, everything is functioning properly.

Proc #18: prcp F/S/FGS ---N t: 0 8656:com.example.my/u0a368 (fg-service)

but:

package: com.example.my
Historical Process Exit for uid=10368
ApplicationExitInfo #0:
timestamp=2023-06-01 09:43:52.752 pid=7411 realUid=10368 packageUid=10368 definingUid=10368 user=0
process=com.example.my reason=10 (USER REQUESTED) subreason=21 (FORCE STOP) status=0
importance=125 pss=99MB rss=217MB description=stop com.example.my due to from process:com.android.vending state=empty trace=null

This is despite the fact that, of course, I did not complete anything myself.

And this bothers me:

due to from process:com.android.vending.


In this regard, I ask you to suggest and guide me on the right path:

A. Do I understand correctly that these surprises began to occur due to the absence of me and my app on Google Play?

B. If I host the application in Google Play, will it solve my problem?

C. If I am mistaken in questions A and B, I ask you to guide me on the right path.

  • 1) Please check your links are your current one goes to posting a question. 2) Just making sure you are aware of: https://dontkillmyapp.com/xiaomi – Morrison Chang Jun 02 '23 at 19:05
  • @Morrison Chang, I have corrected the link. Yes, I know about the resource dontkillmyapp.com/xiaomi . All permissions for the app have been granted. And after that, the service successfully works for a long time (on one of the devices about 12 hours). But then, quite possibly at the same time my service kills Google Play (com.android process.vending). About which there is a corresponding entry in dumpsys. – solaris.chel Jun 03 '23 at 16:44
  • @Morrison Chang, now I have disabled the protection and am testing the application. It's been about 10 hours. The app is working fine so far. If it lasts another 12 hours, then the problem is definitely due to the fact that Google does not know anything about me as a developer, so it considers my application malicious and kills it. But it's too early to draw a conclusion. We have to wait. – solaris.chel Jun 03 '23 at 16:45
  • @Morrison Chang, I turned off Play protection yesterday and the service has been working for a day. – solaris.chel Jun 04 '23 at 07:40

0 Answers0