Android user-permissions in Manifest - android

I declared <user-permission android:name="android.permission.INTERNET" /> in my AndroidManifest since I thought it was the goto way of getting user-permissions.
But I got this warning : "Element user-permission not allowed here"
Via a quick google search I could not figure out what the problem or what the best practice is here.
I am using SDK 21 and up.

Change this.
<user-permission android:name="android.permission.INTERNET" /> //Not Valid
To this.
<uses-permission android:name="android.permission.INTERNET" /> //Correct One

Related

Getting Location Services Running Unity/Tango

I am building a simple app in Unity/Tango platform.
I am trying to get the location.
I followed the steps in this https://docs.unity3d.com/ScriptReference/LocationService.Start.html
So after 20 seconds wait it 'Timed out' and the Status is always 'initializing'.
The Input.location.lastData.latitude and Input.location.lastData.longitude is always zero.
In addition I have set this in the AndroidManifest.xml file:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" android:required="true" />
<uses-feature android:name="android.hardware.location" android:required="true" />
Any help would be appreciated.
-Thanks
Found the answer:
On Android devices, LocationService doesn’t work without setting “high accuracy” location mode in the system settings (“Settings” -> “Location” -> “Mode”).
Reference:
https://issuetracker.unity3d.com/issues/android-locationservice-doesnt-work-without-high-accuracy-mode

How to assign a permission group name in Android

Here's a part of my manifest file:
<permission-group
android:name="groupPerm"
android:description="#string/perm_get_desc"
android:icon="#drawable/ic_launcher"
android:label="#string/perm_label" />
<permission
android:name="bla.bla.GET_PHOTOS"
android:description="#string/perm_get_desc"
android:label="Access photos"
android:permissionGroup="groupPerm"
android:protectionLevel="dangerous" />
<permission
android:name="bla.bla.DELETE_PHOTOS"
android:description="#string/perm_delete_desc"
android:label="Delete photos"
android:permissionGroup="groupPerm"
android:protectionLevel="dangerous" />
This doesn't give me any error. However, when I find in the Application manager this application and I go to Permissions, the two custom permissions show in the group Default, instead of the group I just declared above. Does anyone see what I am doing wrong?
So here is the solution to my own question.
<permission-group
android:name="bla.bla.groupPerm"
android:description="#string/perm_get_desc"
android:icon="#drawable/ic_launcher"
android:label="#string/perm_label" />
<permission
android:name="bla.bla.GET_PHOTOS"
android:description="#string/perm_get_desc"
android:label="Access photos"
android:permissionGroup="bla.bla.groupPerm"
android:protectionLevel="dangerous" />
<permission
android:name="bla.bla.DELETE_PHOTOS"
android:description="#string/perm_delete_desc"
android:label="Delete photos"
android:permissionGroup="bla.bla.groupPerm"
android:protectionLevel="dangerous" />
Apparently, the permission group name should contain the package name also and not just the permission name, as in my previous example: groupPerm. I.e., the correct name should be: bla.bla.groupPerm, where bla.bla is the namespace. If you don't do this, the permissions will show under Default group and would be listed: bla.bla.DELETE_PHOTOS and bla.bla.GET_PHOTOS.

Phonegap 3.1 video capture error data is null

Just upgraded from android 2.9 to 3.1 and now my video capture is not working. I am working on android right now.
I have the following plugins:
camera
file
filetranfer
geolocation
mediacapture
networkinformation
My manifest permissions looks like this:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
From what I have been testing here is what happens:
The capture video opens the video recorder, even with the timelimit I
have set.
I record the video.
It gives me the okay or close, I choose okay.
It saves the video in my gallery (oddly as mp4 instead of 3gpp
which I thought was how it saved videos).
Then instead of going to the success with the mediafile it goes to
error and tells me data is null.
Here is my code to take the video --
var options = {duration: 15};
navigator.device.capture.captureVideo(checkLogin, mediaError, options);
The error message from LogCat--
Cordova Activity Request code = 2
Web Console An error occurred: Error: data is null
Any ideas would be great and if you need more info please ask,
Thank you
My reputation is not high enough yet to simply add a comment, so I'll post this as an answer. If you're still having trouble with this you may want to look at the answer to this question - Phonegap video capture crashes
Looks like modifying the java code for Capture fixed the problem for many people.

why don't Leadbolt Icon ads show up?

I am trying to integrate Leadbolt icon ads into an Android app. I followed the How-to guide: http://www.leadbolt.com/docs/Leadbolt_android_app_guide_v304.pdf . Here's the relevant code:
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- LeadBolt -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
The onCreate for the launcher Activity:
String leadboltIconId = Application.getInstance().getLeadboltIconId();
Log.d(TAG, "leadboltIconId: >" + leadboltIconId + "<");
AdController adController = new AdController(this, leadboltIconId, this);
adController.loadIcon();
"leadboltIconId" is filled correctly. Here is a ss of the config screen:
and the details screen:
I am using an emulator with 2.3.3 on it. It also doesn't work on my HTC Incredible with CM7 ( 2.3.3 ). There are no errors in the log. The activity implements AdListener and none of the methods are ever called.
Please change this line:
AdController adController = new AdController(this, leadboltIconId, this);
to
AdController adController = new AdController(
getApplicationContext(), leadboltIconId);
Also, please note the 3 variable is not needed when running App Icons as App icons will not trigger any event listeners. You need to use the Application Context rather than Activity for App Icons and Notifications. Activity is needed for App Ads.
I've got the same problem with the Ad Icon. I also noticed someone else posting this problem on the Leadbolt Q&A forum recently. There might be a problem with Leadbolt's side, however they fail to communicate this to us...

Android Development: How to request permissions?

I was just wondering how to request permissions when creating an android application. I am a beginner, so please explain in simple terms :D.
So I want to make it so that my app can vibrate the phone at certain times, and the permission is called "android.permission.VIBRATE." But how do I request this? I do it in the Android Manifest file right?
Thanks for all help!
You're definately right. You need to put it in the AndroidManifest.XML
If you're using eclipse you can do it quite easily and without XML by opening up AndroidManifext.xml and use the Permissions tab at the bottom and press the "Add" button and selecting "Uses Permission" Then just select vibrate from the dropdown list.
If you want to do it in XML code you can add it before the application tag, like so:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:name="Application" >
(the rest of your manifest continues from here)
Also, please accept answers if you found them useful. With a 0% acceptance rate, people won't want to answer your questions.

Categories

Resources