My use case is, My app should verify the device pin/password is set. if not then enforce the user to set it up. This has to be performed every time user launches my application and proceed after verification of the pin/password. Can some please help how to implement this. I am using apache cordova and jquery for my application development.
This would be plausible if there were, say, a manifest permission you could add since Android checks the permissions before installing the app, but there isn't that option... Personally, I wouldn't enter my phones "master password" into an app. Too sketchy. Your best option is to create your own password system handled by your app. So whenever the app is run (or whatever your specific need is) you can ask the user to input his password.
Related
I am building an android app, which is restricted to users only using a particular telecom network. And i don't want users who are not on that network to be able to install the app.
So i wanted to know if it is possible to check on which network operator the user is when installing the app.
Thanks.
No. The app cannot run any code while it is installing, or, before installation. Any code will be executed after the app is installed.
What you can do is, after the app is installed, check for network operator. If it is the desired one, let the user use the app. Else, deny any further access.
You can also ask the user to uninstall the app by creating a new Intent with Intent.ACTION_DELETE and specifying the package name. It will give the user an option to uninstall the app.
By default, my android app which I am developing needs the location and the phonebook of the user who installs the app. The counterpart iPhone app pops up with the dialog and ask for user authorization to use both the address and the location info. Whereas, in Android I am not seeing any pop up or restriction in both the simulator as well in the actual physical device in which I am testing.
Can I safely presume that all apps once installed in the android environment will be granted both the location and phone book contact details. Please let me know. If not, is there a way of setting the permission through code or prompt the user for authorization in android?
Thanks for your time and help.
On Android, permissions like these are presented to the user at install time and they must accept them all to continue with the installation so yes.
According to the Android documentation:
The permissions required by an application are declared statically in that application, so they can be known up-front at install time and will not change after that.
Is it possible to require a pass-code when the user tries to uncheck the app as an administrator under Settings->Security->Device Administrators?
This would add a roadblock to not easily allow the user to uninstall the app as they would first need to remove the admin privileges from the app (for which they would need to authenticate with a password) and then they could uninstall.
This is not possible AFIK. This is right of user.
You can show a dialog for confirmation about DE-activation of Device Admin, but neither default device admin API gives you a way to show password dialog while DE-activating device admin, nor EDM APIs gives you the permission.
Although EDM APIs gives a way where you can block the DE-activation of Device administrator. So user can not uncheck a particular Device admin.
It is possible, but you'd have to employ some pretty sketchy techniques to achieve that. For example, Cerberus has an option called "Protect device admin" which immediately locks your screen and asks for login and password as soon as you tap "Deactivate this device administrator".
I cannot recommend you do this though since it's considered to be malicious behavior. You should use corporate policies instead. AFAIK they've been implemented to newer versions of Android and are not tied to a specific manufacturer.
I am developing the android application in which
The application has a stored password (set by user when application is first installed)
My application is the device administrator
The issue is when user clicks on uninstall of this application , i want user to input the password of the application
The process i will follow there after is :
Show password Page
Remove Device admin Rights by certain code
Allow un-installing
Please help me with the detection of the uninstall click of my application to shoot the password page.. !!
Thanks in advance !
Do you mean to intercept the uninstall of your app, and query for a password? That is not possible. Similar questions has been asked before, for example here.
Edit: It does seem as some related things can be done by making your application a Device Admin Application:
"To uninstall an existing device admin application, users need to first
unregister the application as an administrator."
However I am not familiar with the restrictions that comes with this, and if it allows your exact use case.
I want to create an application that prompts the user to create a password before the application is installed and also before the application can be uninstalled the password must be entered.
I have ran out of ideas on how to go about the code.
Please can anyone give me a code and an insight on how to go about this_
I would appreciate a lot.
You can use shared preference/db to have default value and see if there is a default value you can prompt dialog
I want to create an application that prompts the user to create a
password before the application is installed
To be clear you said BEFORE the app is installed. This might be Possible. But "dirty". In the user journey your user downloads and installs the APK from the market or where ever. None of your app code has run yet so there's nothing to leverage.
A possible work around, which I have heard others use but not tried myself so no guarantees, is to write a login app that when installed prompts for password creation and on success downloads the actual app.
I would probably say - why? What it the motive behind doing this? Lots of apps work fine installing the whole app (Spotify comes to mind).
I don't think this is possible the android market takes downloads and installs or user installs some other way and the user uninstall via manage application in the settings, all of these things happen outside of the scope of an app
See Device Administrations API