Android user permissions - android

I am new to android development and I am making a tic tac toe game for a project at the university.
I know it is a simple game, but I need to add a permission to it so I can show that android has some kind of security.
I was thinking about the thing where the screen doesn't automatically locks, WAKE_LOCK or something like that.
How to implement this ? Is there a way besides the one where you add the code to your xml file ?
I mean something that has to do with <user-permissions.... /> in manifest so a pop-up with accept can appear to the user ?
Is it enough to add that line to the manifest file or coding is required ?
Thanks.

this is enough
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>

Related

How to find source of a permission in an Android app?

My users are complaining that my app now requires "run at startup" permission according the listing on Google Play. I have no need for this permission so would like to remove it from my app. I assume it must be from a library that I use but which one? In the "Merged Manifest" there is nothing about "boot" or "startup". I just have these:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
How can I track this down? My users are acting like I'm the anti-Christ for having this extra permission and I look stupid(maybe accurately) for not knowing why. Also, is there a list somewhere that shows what permissions correspond to what text on the Play store description page?
I want to address the comment about removing the permission. I understand how that is done and that's not what I'm asking. I need to know how to find the permission. Else, how can you remove something if you don't know what is is? Also, I may want to keep the permission but need to explain what it is for to my end-users.
#Mike is probably correct about WorkManager API. Still the question is how did he find that out? Why doesn't Android Studio show the permission in the Merged Manifest?
Also, even stranger is that I have removed the WorkManager API so the permission should be gone. I did check out the code for the released version and there are no left over references to WorkManager.
The easy way is from Android Studio. First build your app. Then from the build menu select Analyze APK. From there you can see the full AndroidManifest.
https://developer.android.com/studio/build/apk-analyzer
In my case the permissions did not show up in the Merged Manifest tab. Could be a bug. I think what happened is that I used a library during beta testing. Removed the code that uses library but still had a reference in build.gradle. That added the permission to the released apk's Manifest.

Is it possible in android that don't ask for permissions mentioned in Manifest.xml file, if code is not in use?

I've mentioned the following permission:
<uses-permission android:name="android.permission.NFC" />
in my manifest.xml. But NFC code is no more in use and I commented the source code. Means NFC is no more in use for my app, but while installing the app, it's still shows in installing window.
So, is it possible in android that don't ask for permissions mentioned in Manifest.xml file, if code is not in use? Thanks
No, it is not possible, because the Android system has no idea which permissions your application requires before run-time. Picture the following scenario:
You are writing an application, not specifying NFC permission as you're not using it in your code, but you ARE using a framework that in 50% of the implementations do use NFC (device manufacturer specific framework).
The Android system has no way of telling if the NFC permission is required and thus it relies on your explicit instruction for permissions
As I'm sure you've noticed, an exception will be raised if the permission does not exist for the specified action
The only way to make sure the requirement is gone is to remove the permission from the manifest (and frankly, is it that much of a deal?)
Besides commenting out the unnecessary codes, you have to remove the permission from your manifest as well.

Android RECORD_AUDIO permission in unity3d

android.permission.RECORD_AUDIO
I'm not using this permission in my manifest file and I even searched in my whole project and didn't find it. But still when I try to install my app, it asks for this permission and if I click on it, it gives me msg
Microphone
provided by Android System
android.permission.RECORD_AUDIO
I want it to be removed as I don't want to use it! Any idea how to remove it?
One of library accessing microphone in script and I think unity adds permission based on that by it self.
if you dont know who is adding it you can remove it in the final manifest by using xmlns tool like below
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:installLocation="auto">
...
<uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove" />
...
ofcourse just be careful and make sure no code really require it since you might crash if code or one of your plugins enters a point where it requires this permission to run

changing wallpapers automatically in android

i am new to android programming and want to develop an application similar to vista where the wallpaper changes automatically , so how should i go about it, please could someone guide me on it? thanks
You would need to use the Wallpaper Manager Api : http://developer.android.com/reference/android/app/WallpaperManager.html
Here is a related tutorial : http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/SetWallpaperActivity.html
Basically, you will have to use the WallpaperManager class which provides the neccesarry methods to do so.
Also, don't forget to add the SET_WALLPAPER permission to your AndroidManifest.xml:
<manifest xlmns:android...>
...
<uses-permission android:name="android.permission.SET_WALLPAPER" />
</manifest>
Edit: take a look of the example that Ravi Vyas gave you... I didn't know about it and it looks pretty useful.

Application installer tells that my app reads Phone State and identity :-(

Hoi,
I have a simple app with a surfaceview nothing special one would say. However when installing on my phone I get two warnings.
1 - Phone calls
- read phone state and identity
2 - Storage
- modify/delete SD card content.
My really is nothing more than a simple puzzle and I dont understand why I get these warnings.
Any ideas how to avoid this?
Help is very much appreciated,
Kind regards
Jasper de Keijzer.
I guess the warnings you mention are user-permissions in the manifest. Check if you have in your manifest lines like:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
and delete them.
It is most likely due to building the app for Android 1.5 (or earlier) and running it on a 1.6 or later device. According to this answer elsewhere on StackOverflow, you can fix it with the following line in your manifest:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="4" />
It hasn't worked for me, though.

Categories

Resources