Some Sony devices have a Stamina mode to increase the standby time of the device. It turns off
data traffic and prevents background activities from waking up the system. Apps can be white-listed though.
Some users have reported that my app is removed from the white list after each reboot which is bad because it's an email client that should be able to wake up the system when new mails are pushed.
Does anyone have more in-depth information about the Stamina mode and why it would remove apps from the white list?
My online research didn't bring up anything useful on this.
There are a couple of articles about the mode but they don't go any further than explaining what the mode does and how it can be configured. The best I could come up with was this: http://commonsware.com/blog/2013/03/08/warning-xperia-z-stamina-alarmmanager.html but that doesn't answer my question either.
Well, I can tell you that on an SONY Xperia Z, with the latest firmware, I cannot reproduce the problem. Apps added to the STAMINA whitelist survive a reboot.
Beyond that, I suspect that you will need to contact SONY.
After purchasing a Sony Xperia Z and doing some extensive tests I finally found the offending "component" ... the package name!
I created the most basic test app with one Activity (doing nothing), one app icon, one string for the app name and the manifest file. I installed the app with two different package names (from two of my apps):
package="com.onegravity.sudoku4ever.free"
package="com.onegravity.sudoku.sudoku10kfree"
I then added both apps to the white list, rebooted the device and the second app disappeared from the white list. The app is also removed from the white list if it's the only one installed (If I install only the test app with package name com.onegravity.sudoku.sudoku10kfree).
I didn't run any further tests to find out which package names "make it" because the package name is the one thing I can't change in my apps.
Obviously there's a major bug in the stamina mode / white list component and only Sony can fix it ;-(
Related
My app needs to allow users to disable doze mode for my app, so for that the app needs to open android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS but I get android.content.ActivityNotFoundException when trying to open that intent on some Samsung phones like the Galaxy A5.
Is there an equivalent on those phones? What about other phones?
Thanks.
Edit: I just want to be clear, I'm trying to find what the actual setting screen is on Samsung Phones like the A5, not just how to open settings. I need to direct the users to the right location.
Edit: To clarify further, we have no found the setting on that Samsung phone to make isIgnoringBatteryOptimizations() return true. That is my main question, what setting needs to change on that phone for that to become true.
The Samsung Galaxy A5 ran on three OSs:
Android 6.0.1, Android 7.0, Android 8.0.0 (GFX Bench)
The android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS activity was added in API 23. It was not removed afterwards. For some reason, this bug was never addressed by Samsung. The only solution is to bring the user to the system settings screen. See the following solution:
https://github.com/kontalk/androidclient/commit/be78119687940545d3613ae0d4280f4068125f6a
EDIT
After misunderstanding the question and with the clarification of the OP, I've added a potential solution to address which power setting needs to be accessed.
If you haven't already, make sure you are using android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS. Be sure that you add REQUEST_IGNORE_BATTERY_OPTIMIZATIONS in your manifest prior to using this activity.
Activity Action: Ask the user to allow an app to ignore battery optimizations (that is, put them on the whitelist of apps shown by ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS). For an app to use this, it also must hold the Manifest.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission.
This should bring the user to the exact option necessary.
If you have one of these phones (maybe virtual from some online services) you can run the adb command to find the running activities, this way you can check the intent and maybe you are allowed to call it:
adb shell dumpsys activity activities
The MediaPad M3 does not log anything related to the app I am developing (compared to other Android devices). I understand that the log level usually can be set on Huawei devices via a hidden menu.
I came across these instructions many times while searching for the solution: https://gist.github.com/Shallong11/8403487
However, this is a tabled and it doesn't have GSM support and a Dialer / Phone application. So I fail at step one: dial ##2846579##.
Update #1: I've tried everything listed here: https://android.stackexchange.com/questions/59259/typing-dialer-secret-codes-in-devices-other-than-phones
Nothing works. The only reaction I've gotten: startActivity call with Intent.ACTION_DIAL is handled by Contacts app. Quite strange that there's a Contacts app but no Dialer...
It's probably meaningful to add that debug logs are displayed but stack traces of app crashes are not.
Update #2: I've also tried with some of these secret codes; nothing works: http://mobilespecs.net/phone/codes/Huawei/Huawei_MediaPad_M2.html
Because there is no dialer on the tablet, open calculator in landscape mode and enter
"()()2846579()()=" and the hidden menu should appear.
Here's a video demonstration.
Also please note that you'd need to restart the device afterwards in order for the changes to be applied.
I have an customer project where I have to make single task android device. Customer isn't able to escape the application which my company have developed. Also customer isn't able to start any other application and our application is started when the device is booted. Overall all the customer is able to do with the device is run our application.
Is there any other way to make this work than rooting the device, disabling all system buttons and making our application the launcher. I have something like 400 devices for this purpose so rooting all those would cost lot of time.
I also read Google's tutorial about COSU devices but found it very confucing https://developer.android.com/work/cosu.html#testing-plan
Androids own screen pinning is not good enough because customer can escape the app. Some may suggest to use some kiosk application like SureLock but my company's goal is to find clear solution for this without using any third party apps. Also running our app via some kiosk application is not our goal.
I found some posts on the Stack Overflow with similar question, but not the answer I'm looking for.
If someone has some tips for this question I would be very grateful.
Single purpose devices built on top of Android can get difficult to implement. There are a few different options, but each have trade-offs.
As you mentioned, rooting devices will functionally get you what you want - however it will be time consuming with hundreds of devices to root, difficult to maintain, and you will (potentially) introduce security issues to your devices and app.
Another option is using Google's Lock Task Mode for COSU devices[1]. The link there has a nice graphic showing the features of lock task mode:
1 app pinned to the home screen
only apps white-listed by the DPC (device policy controller) can be locked
Home and Recent buttons hidden
exit by calling stopLockTask()
There are some downsides to using Google's solution for this. First Google recommends creating (and therefor maintaining) an entirely separate DPC app to run as a device owner and set policies[2]. You'll also be dependent on Google Play to manage application updates and be required to have Play accounts associated with each device which "are used to identify a single device that is not tied to a single user for simplified, per-device app distribution rules in COSU-style scenarios"[3]. To automatically get your DPC app on devices your "DPC must be publicly availble on Google Play, and the end user can install the DPC from the device setup wizard by entering the DPC-specific identifier."[3] You'll also need to upload the user application to Google Play[4], which may be an issue for some who don't want their apps on Play. Going this route gives you features you need, but can be complicated and also ties you and your customer pretty tightly with Google/Play services and their workflow.
You can also look at enterprise mobile deployment platforms like Mason[5]. In your case, you can create a custom Android OS in a few minutes with your app locked in kiosk mode (+ other features like disable camera/sms, remove apps and hide settings, etc.) and then deploy it to all of your devices remotely. Mason also supports OS and app updates controlled by you if your requirements change.
DISCLAIMER: I work for Mason
[1] https://developer.android.com/work/cosu.html
[2] https://developer.android.com/work/cosu.html#create-dpc
[3] https://developers.google.com/android/work/requirements/cosu
[4] https://developers.google.com/android/work/play/emm-api/samples#push_install_an_app_on_a_device
[5] https://bymason.com/
I went to the same problem before. I spent at least 3 days doing research. I tried to find many solutions but I found zero.
How I solve is
1. Up To JellyBean
- Use System Alert Dialog (And make it transparent and small size like 2 * 2 And display in some corner(User can't see it)). User can't press home button If there is system Alert dialog
2. After JellyBean, This method doesn't work. The user can press the home button even though there is System Alert Dialog.
so what I did is, start the service on stop and start the same activity again and again(within sec). So user can't see any difference.Don't forget to make activity as single task so that even though you start same activity from service, again and again, new activity will not create (So Ugly way )
- You can simple make screen full screen. make sure in kiosk mode try to check if the screen is in full-screen mode. if not make it full-screen mode(its not hard to do)
- other way is to make launcher app but when ever you pressed home button it always asked to choose launcher app. if user mistakenly choose default/ other launcher app, this solution doesnt work
Good luck
Make your application as a launcher application by defining in manifest file.
After that go to setting of your mobile device and change default launcher application to your application.
I'm new in Android developing (I'm a developer iOS from 3 years) and the very first thing that I notice in Android is that when I install my app from Android I need to unlock the screen manually.
This might seem like an unimportant thing but very often I'm wait in front of the screen for a few seconds and then I realize that I have to unlock the device manually.
Thanks
Well, I don't know about auto unlock but you could set "Stay Awake" in developer settings on your phone. This means the screen will not lock when you are connected to your computer. Not compatible with all phones due to some screen types.
Also, you could have a scout around the Play Store. There are numerous attempts at this but with varying results I suspect.
--Conor
Stock Android doesn't support 'badges' (e.g. unread count on a messaging app) that overlay the app icon like on the iPhone. There are a number of questions here on Stackoverflow which confirm this and suggest using a widget.
Whilst widgets are lovely things, they require too much interaction from the user to get in place (all that searching, long pressing etc.) and don't actually change the app icon. So no, that is not an option.
I accept that Android doesn't have app icon badges. However, HTC Sense and Samsung TouchWiz do. I'm looking at my Galaxy S right now, and the app launcher Messaging icon has a badge with the number of unread SMS messages.
Does anyone know how to access this badge functionality individually for Sense and TouchWiz devices? (I expect there are two APIs).
I don't know about HTC but I've written up how to do this on Samsung phones here How to interface with the BadgeProvider on Samsung phones to add a count to the app icon?
Does anyone know how to access this badge functionality individually for Sense and TouchWiz devices? (I expect there are two APIs).
Become an employee of HTC or Samsung, respectively.
HTC might start offering an API for stuff like this through Open Sense. Samsung might start offering an API for stuff like this through their developer site. I am not aware that either are at present and I wouldn't count on it becoming available.
What you are seeing is a feature of those home screens. You are, of course, welcome to write your own home screen where you have this functionality, perhaps even exposing an API for third-party developers to use.
Still no positive answer to this?
It's very strange that they (HTC and Samsung) haven't come up with a way for third-party apps to update their widgets! So we end up with users of third-party sms apps to complain about the sms counter not updating when it should. This is very sad, especially on the Android world where app integration has been made so easy by the framework! Such implementations should be negatively judged by Android community and the Android Alliance!
If anyone has found a work-around for force updating the widgets of the vendor specific sms apps (HTC and Samsung), so the unread sms counters correctly update, and would like to share this knowledge, you are more than welcome!