Android permissions: asking options guide - java

I apologize in advance for my language and if this thread is a duplicate.
I would like to ask for a 'mini-guide' on android permission asking for 6.0+. The problem that I am personally having is some applications I recently released require permissions like internet and external storage. But the only way I could 'help' the user from going manually to settings -> app settings etc, is launching an intent on button press for the app setting page.
So what I am asking is:
For newest versions of Android (assuming it will work on most older versions too),
is there a way to:
Ask for every permission you need to be accepted before downloading on Play Store and then enabled by default?
Ask on first time app launch to give permanent permissions to app and on positive response, programmatically enable them?
Ask the user for a one-time, dynamic, TEMPORARY, permission request. For example, app1 does not have permission to write to an external storage. On button1 press, ask temporary permission to write to a file in the external storage. If the user clicks button1 again, permission will be asked again.
Again, apologies if this question has been asked before. I want to assure you I did a lot of research, and most of the answers I found didn't seem to work...
Thanks

1) I think its not possible to enable all permissions by default since its a major update in Android 6+ devices to enable users to control runtime permissions the app needed.
For 2 & 3)
For my project I have written a static java class to request android runtime permissions. You can use that if you want. You have to add other permissions as you need in the same pattern as described in the class.
I have provided the Github link below
Github

Related

Google Play Policy for Package Visibility for pre-android 11

I read this link and this question here but there is something I don't understand.
I have this line of code in my app packageManager.getInstalledPackages(flag), However i'm not using the QUERY_ALL_PACKAGES permission which is understandable that I will not be able to receive the user installed packages, that's not an issue as of now for me. However, The first link stated that:
The inventory of installed apps queried from a device are regarded as personal and sensitive user data
So will using this method packageManager.getInstalledPackages(flag) consider a violation and cause my app to be removed from the play store?
Thanks for your time and input.
Using the following method
packageManager.getInstalledPackages(flag)
will not be considered as violations. However this in android 11 will only give you list of packages of open apps to user.

Remove android setting screen from recent list [duplicate]

I was wondering if anyone had a relatively simple solution for us.
We created an app to be used by our clients on android devices that we give them.
We would like the client to only be able to use our app and have limited access to everything else (i.e. settings, email etc.) What is the best way to achieve this without using 3rd party apps.
Thank you in advance!
This may not help but the L preview has a task locking feature included that may be of some insight, I'm not aware of how it functions as yet
Task locking
The L Developer Preview introduces a new task locking API that lets you temporarily restrict users from leaving your app or being interrupted by notifications. This could be used, for example, if you are developing an education app to support high stakes assessment requirements on Android. Once your app activates this mode, users will not be able to see notifications, access other apps, or return to the Home screen, until your app exits the mode.
http://developer.android.com/preview/api-overview.html
Hope this helped
Suppress the Title Bar & Make Your App a Launcher
Root Your Tablet
Modify System Files and Settings to hide the soft keys
On the next link you can find the complete solution for the Nexus 7 (2012)
http://thebitplague.wordpress.com/2013/04/05/kiosk-mode-on-the-nexus-7/
simple Answer is:
Lock Install button with modify system settings.
Create your own customized-ROM and apply your requirement to that ROM.
more info, visit XDADavelopers

Java/Android - Best way to update apps that are not in the Play Store

I am installing security software/hardware into a couple different school districts. The application is at it's final stage, however I will need to send updates to users periodically. For example, a general password will be changed for the application every 6 months.
Installing an .apk is considered an "update" after the initial application is installed, correct?
I just have a feeling that there should be some easy way of doing this. I don't really want to give people an .apk. Someone could get smart and tear it apart to find the contents. That, and some others might not understand how to install files on their phone.
What are your ideas? Maybe a web link a user can go to that starts the install for them?
You have multiple misconceptions how updating, APKs and keeping keys secure work.
You have to host your APKs somewhere. Github releases is a pretty common way (but slow), but you could also use google drive, dropbox or your own server.
Your app has to fetch the server regularly and check if a new APK is available (pull-based). Second option is to use push notification in some kind e.g. FCM (push-based). Then you download the APK and let the user install it. Your app cannot start a installation by itself, it has to be done by the user.
But you can redirect the user to the installation menu with that APK, so he just has to click "Install". "Install from unknown sources" has to be enabled for that, if not the user will get an information about that from the OS with a way to enable.
There are apps like "APK extractor" which get you the APKs from google play without root, so there's nothing wrong about giving out the APK. Your APK should never contain secure keys which the user isn't allowed to see. It's easy to reverse engineer those keys, it's just a matter of time.

Android Dev Q Regarding Permission Request

Hey all!
So as Android Devs know, Android M introduced a new Permissions system.. I am nearing the end stages of Coding my App, and implementing this Permission Request is one of my final tasks. I just have a few quick questions about the way it works..
Upon starting my App for the first time, the user see's a Welcome screen, with a view pager type of interface with 4 pages containing information about using the App.. The last page will explain to the user that the App needs a Permission to be granted in order to use the App, and upon clicking a "Lets get Started" Button, I will have the Permission Request pop up..
Here are my Questions:
(1) - Am I actually able to Request the Permission on the fly like I descibed above, to be used later at some point, before I actually need to use the Permission? or am I limited to Requesting the Permission at specific times, such as when I actually need it, or at runtime, etc..?
(2) - Once the user Grants the Permission I Request, is it permanent? or will I need to Request Permission yet again if for example they reboot their phone etc?
Huge thanks for the information!
You can request for Marshmallow permissions at any point of time, they are not limited.
Yes, once the user grants the permission it is permanent, so no pop up will need to be generated. Although the user will still be able to manually remove the permission from the Settings app, which will require you to ask for it again next time you'll need it.

How to disable the "uninstall" button in Android?

In Android some system applications cannot be uninstalled.
Is there any way to configure an application so that it cannot be uninstalled by the user?
I want to hide the uninstall button in app settings, like a system app such as this:
Not really - the only way to achieve this would be to create a custom ROM. The uninstallable apps are "system apps", or apps installed by default. Often, those are unneeded apps added there by the mobile network or the phone producer. Even those can be uninstalled though when you root your phone :)
Your app can disable the Uninstall button by requesting Device Administration permission from the user.
The user cannot uninstall until they remove the Device Administration permission in Settings. In this case your app's DeviceAdminReceiver will be called, giving your app a chance to react.
http://developer.android.com/guide/topics/admin/device-admin.html
I guess you're mainly looking for a technical solution. But as there is no purely technical solution for a wider audience, you might be open for alternatives:
The phone manufacturer and the telecom provider have means to pre-install apps on a phone that cannot be uninstalled. So one way would be to get in contact with them and see if one of them is willing to cooperate with you. You'll probably need to offer them something in return.

Categories

Resources