Automatic updates on Android devices (Apps) - Kotlin - android

When I publish a new version in google play, why is not updated automatically in the final devices? even though the option of automatic update in the devices is activated

It will be updated automatically in devices with automatic updates, but not immediately. Some things that you might not expect:
Devices only checkin to Play about once a day for updates, then do all their updates together, instead of getting a push notification to update when a new version of an app comes out. If the push notification happened, imagine what would happen when YouTube pushes an update. Immediately 2 billion devices would all hit Google Play servers at the same time. This would be like a DoS attack on Google Play. Because different devices check in at different points over 24 hours, the load is spread.
By default devices only update when connected to WiFi and plugged into a power supply. Plugged into WiFi is the option because data can be very expensive for some users. If users want to update on mobile data they can change the setting. Power is because some update operations can use a lot of CPU. Downloading uses the network circuits and decompression and patching can be quite CPU intensive. By waiting until the device is plugged in, Google Play doesn't suddenly drain the battery of a user who is hoping it will last until they get home.
But you should see automatic updates for most users within a day or two of publishing your update. Some users itwill take a lot longer because they have disabled automatic updates or rarely have WiFi and Power at the same time.

Related

Nearby Connections API and Nearby Share discovers same device more than once

There is a problem I've noticed with the Nearby Connections API, sometimes the same devices gets discovered two or more times. They have the same name but different endpointId.
If we try to initiate connection with the first discovered device it never succeeds, connection is established only when selecting the device which was discovered last.
I've spotted the same problem with the Nearby Share functionality.
Is there any solution to this problem, like could we make the advertising device not change it's endpointId?
This should be fixed next week.
We made a change to rotate the EndpointID if the device stopped / restarted advertising. The goal was to better protect privacy, but it had the side affect of showing multiple targets until the first one times out. In the change that's now rolling out, restarting a high power advertisement within 30sec will reuse the same ID.
You can test the change out today by joining the Play Services beta.

Android - Detect if other users of my app are nearby

I'm working on an Android app that needs to detect if other users of the app are close to each other (lets say within the same room or Bluetooth range). The app needs to be able to detect this without any user interaction.
Geolocation is not an option as this is too inaccurate indoors.
The app runs only on company owned phones that stay on company ground, privacy is not a concern.
All devices are always connected to the same wifi network and BT is always enabled.
My idea is to detect if users are within a close distance of eachother by periodically Bluetooth scanning and checking the results against a list of MAC adresses that contain all the devices that have the app installed.
The MAC adresses of all devices are send to a server, the devices then grab this list of mac adresses from the server to compare to the results of a BT scan.
Problem is, BT and Google's seem to use Advertisement / Discovery patterns where one device acts as the server and one device acts as the client. For this to work properly i feel like the devices need to always be discoverable.
Will an implementation based on Google's Nearby or BT work for my needs ?
Is it possible to detect the presence of a nearby device without it being discoverable ?
As battery life is a concern (need to be able to do this for atleast 8 hours a day) is BLE an option?
You can almost certainly handle 8 hours a day if the phones aren't really used for much else. There are a lot of variables, however.
Many older phones require a different type of scanning using infinite scanner restarts in order to properly report "seeing" a peripheral. This can dramatically decrease battery life.
If the phones are running Marshmallow or later, they have a doze mode which interrupts scanning. This can be circumvented using an AlarmManager, JobService/Dispatcher, or WorkManager. This can dramatically decrease battery life.
If the phones are running Oreo or later, they require a foreground service (persistent notification) in order to prevent the app from being automatically killed by the OS to save battery. The app should also be whitelisted from battery optimization because even with the foreground service, the app will still be killed off by the OS.
Finally, scanning and broadcasting and using location services is pretty expensive battery-wise. If you're attempting to cluster phones and guess their position based upon what other phones are nearby, at some level you'll still need the location data off of the phones to figure out where they're at.
You're much better off just scanning. You could carpet your company property with beacons, where each individual beacon's location is recorded. When the phone "enters a region" (comes within range of a beacon), it should send something to your api reporting which beacon it just found. This will tell you what room/area it's in.
Another less flashy (and potentially less accurate) way to track everything would be via the IP addresses of the wireless access points they're connected to. Use a WorkManager to periodically update an api with some unique ID for the phone and the IP address of the AP. Your IT department should know the locations of each of them. This way you get reasonably good tracking and virtually no battery drain.

Auto-Update of a running app doesn't work

I have an Android app which runs unattended on a tablet running Android 6.
I've uploaded an alpha version to Google Play and install it on an Android tablet.
I've remain logged-in to the Google Play on the tablet and auto-update is turned on.
Yet, my app is running now for 2 days since I've pushed an update to the app and the app still did not update.
If I open Google Play on the tablet I see the new version.
Is there anything else I need to do to have the app update automatically without use open Google Play and press Update?
Apps restart when they get updated. Because of this, Google Play tries to avoid auto-upating apps when they are running in the foreground as this is a bad user experience, the app restarting while the user is using it. This is one possible reason.
Another reason is Google Play by default only updates apps when the device is plugged into power and connected to wi-fi, to avoid draining the battery and using up the user's mobile data. This could be another reason.
However, if the app is not in the foreground and the tablet is plugged into power and on wi-fi, and autoupdate is turned on it should update within 24 hours. If it doesn't this is probably a bug. You should take a bug report and contact Google Developer support using the Google Play console.

How I can avoid battery optimization of Samsung devices? (S6, S7 and S8)

I have a GPS tracking Android app that receives continuous push messages when someone requires user's position.
Everytime that I receive a push, I start the location service that send positions during X time while he is receiving push messages.
The problem started with android Doze system, that block http requests. I could receive messages but I never could send my current position (I received timeouts of http connections and error in pings to Google). But i could solve it with ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS request and adding the app into battery whitelist programatically.
Now, the app works fine in all devices except on Samsung devices over S6, that have "Smart manager" system. I tried to add manually the app into Samsung's battery whitelist (Setttings -> Device Maintenance -> Battery -> Unmonitored apps) but the problem persist.
If I keep the device with screen off and no charging, in a few time, it stops sending positions, but he still recieving push messages.
Can anyone help me with a magical solution? I saw a alleged "packages list" with a lot of apps that Samsung includes automatically into whitelist (Facebook, Whatsapp, Life360, for example) but I couldn't find what I need to do to add my app into this list automatically.
Based on the link provided by #ManmeetP, it looks like your only option is to use Samsung's "Knox" SDK: ApplicationPolicy.addPackageToBatteryOptimizationWhiteList()
https://seap.samsung.com/api-references/android-standard/reference/android/app/enterprise/ApplicationPolicy.html
This would mean bundling that SDK into your app for all your users =(

What kind of app should I write to gain control of a lost Nexus ... that I see in my Google Device Manager?

I have (had) a Nexus device and lost it while backpacking in Europe. One year later, I've been able to see it online at the Google Device Manager, near southern Italy.
Despite me trying (and failing) to contact the owners of the Hostel, I've been unable to get the device erased or returned to me. For the past several months the device has been powered on and active.
My goal is to write an application, deploy it to the app store, and use my Google Play account (connected to the device) to download the app as I could do in the screen below.
I want the app to either
Erases the device
Locks the screen with a "Reward" message
An audio message
Something else?
.. the issue is that the user might not "permit" certain supervision activity if the OS requires it. (Device Administrator for example)
Question
What can I do on a 4.x Nexus, not requiring additional interactive permissions, after I send an app from the app store, to accomplish the goal of notifying the user (in Italian) or erasing sensitive material?

Categories

Resources