I'm very new to Android/Java development and i've been attempting to build a plugin for Cordova over the past few days and have gotten to the point at which it's executing in my app, however i'm getting this frustrating error in adb logcat whenever I attempt to execute a function:
ActivityManager: Permission Denial: Accessing service ComponentInfo{com.kddi.market.validation/com.kddi.market.validation.alml.service.ALMLService} from pid=20745, uid=10336 requires com.kddi.market.permission.USE_ALML
The documentation for the library which i'm using states that 'com.kddi.market.permission.USE_ALML' must be included in androidManifest.xml, and so I have:
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="30009" android:versionName="3.0.6" package="com.smartpass.asianvalue.skychasers" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="#mipmap/icon" android:label="#string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="landscape" android:theme="#android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
<uses-permission android:name="com.kddi.market.permission.USE_ALML" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>
Been at this problem for a few hours now, I'd really appreciate if someone knowledgable could give me some insight into what the problem could be.
I've seen other people have their problem solved by the inclusion of android:exported="true" in their activity but this hadn't worked for me, maybe along a similar line?
I'd also attempted to request permissions on runtime using the following:
if (action.equalsIgnoreCase("initClient")) {
if(cordova.hasPermission("com.kddi.market.permission.USE_ALML")) {
this.initClient(callbackContext);
} else {
cordova.requestPermission(this, 0, "com.kddi.market.permission.USE_ALML");
}
return true;
}
I've found the solution, the permission wasn't being defined before it was used. I've never seen anyone have to use custom permissions like this before, and it also seems kind of redundant to have to define and set permissions right next to each other.
Instead of my 'androidManifest.xml' only having:
<uses-permission android:name="com.kddi.market.permission.USE_ALML" />
I needed:
<permission android:name="com.kddi.market.permission.USE_ALML" />
put before it.
weird.
Related
I use the cordova 6.4 with that plugin:
cordova-plugin-sms 1.0.5 "SMS"
When I do install it, on Android 4.3 it asks for sms sending permissions and works great.
On Marshmallow however, the APK installs WITHOUT asking any permissions (and of course cannot send SMS until I go manually to application, parameters and allow manually SMS sending)
In my /plateforms/android/AndroidManifest.xml I have that
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="com.proxymis.sendSMS" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="#mipmap/icon" android:label="#string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="#android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="24" />
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.RECEIVE_WAP_PUSH" />
<uses-permission android:name="android.permission.RECEIVE_MMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
</manifest>
Question: How to set permissions or config so I can send SMS with Marshmallow ?
Below Android 6.0, you ask for them in the manifest (like you did), and you always have access to them.
On Android 6.0 or higher, permissions have to be asked for at runtime.
Google "Android runtime permissions" and you will find loads and loads of guides and posts about it.
I've never worked with Cordova before, so i don't know how that will work, i've only worked with native Android applications. But my best guess is that there is a plugin that can help you.
I am new to android, I want to know whether android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE have default permissions ???
This is my manifest.xml file
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.sample.test" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="#drawable/icon" android:label="#string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="#string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:screenOrientation="portrait" android:theme="#android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="#string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
</manifest>
But it still show <user-permission> as
Uses Permissions:
android.permission.INTERNET
android.permission.READ_EXTERNAL_STORAGE
android.permission.WRITE_EXTERNAL_STORAGE
Defines Permissions:
None
Is there any other way to define such permissions
I am using drozer to check vulnerability in my app
Thanks.
Apps didn't need WRITE_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE in the past to access external storage. But that will change in the near future (see 'Caution' section in the referenced guide). So, previously apps were able to write to external storage by default. Also, WRITE_EXTERNAL_STORAGE includes READ_EXTERNAL_STORAGE so you don't need to obtain both.
Here's the relevant user guide: https://developer.android.com/training/basics/data-storage/files.html#GetWritePermission
So, for devices with API level 23 and later add the respective permission to your manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
According to the documentation: A basic Android application has no permissions associated with it by default. See the section labeled Using Permissions.
When viewing my app in Google Play on my ASUS Transformer tablet I see the following message
Your device isn't compatible with this version
Here is my manifest file.
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true"
android:versionCode="3"
android:versionName="1.0.2"
android:windowSoftInputMode="adjustPan"
package="com.sheffieldlentinepc.sentenceestimator"
xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required permission to check licensing. -->
<uses-permission android:name="com.android.vending.CHECK_LICENSE" />
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="18" />
<application
android:hardwareAccelerated="true"
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale"
android:label="#string/app_name"
android:name="SentenceEstimator"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Is there anything in my manifest that would cause this device to be incompatible?
OK I got it! My situation:
Originally a phone only app
re-designed for tablet optimization
I thought marking this permission to required="false" was all I needed since tablets don't have phones. <uses-permission android:name="android.permission.CALL_PHONE"
**android:required="false"** />
My confusion was the <uses-permission/> and <uses-feature/> after reading this over for the 10th time I finally caught it. http://developer.android.com/distribute/googleplay/quality/tablet.html#hardware-requirements
I needed to explicitly add <uses-feature android:name="android.hardware.telephony" android:required="false" /> to my manifest.
upload to to developer console and you should see the number of "supported devices" jump, 541 devices in my case.
Of course if you have features that require phone use you need to handle it appropriately at run-time for devices that don't have phone.
Adding <uses-feature android:name="android.hardware.telephony" android:required="false" /> to the manifest added support for your AsusTransformer TF101G too!
I hope this helps someone else!
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.onsite"
android:versionCode="1"
android:versionName="#string/app_version" >
<uses-sdk android:minSdkVersion="8" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true" >
</supports-screens>
<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" />
<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.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name"
android:name="MainApplication" >
<uses-library android:name="com.google.android.maps" />
<activity
android:label="#string/app_name"
android:name=".Startup"
android:theme="#style/SVSSplashTheme"
android:windowSoftInputMode="stateHidden" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
This is my manifest. If I remove <uses-library android:name="com.google.android.maps" /> I can install export APK and install it in the device but my android map Activity crashing. If I add this line I can't install APK. I am not getting the Application installed.
Can anyone tell me what I am doing wrong? Thanks in advance.
Only a guess without seeing the logcat, but probably you are trying to install onto a device which lacks the libraries implementing the maps api.
If this is a physical device you are out of luck - your vendor did not license this proprietary component from Google. (you could check how supported open street map is on Android?)
If it is the emulator, you need to switch to an AVD based on one of the "Google APIs" images.
Please check your consol if it is giving the error like,missing shared library,then launch a new emulator with android Google API 2.2 or whatever OS you are using,then your map application work perfectly.
Ok so I have my android manifest:
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="" android:versionCode="6" android:versionName="1.2.3">
<uses-sdk android:minSdkVersion="7"/>
<application android:label="" android:icon="#drawable/icon" android:debuggable="true">
<activity android:name="com.google.ads.AdActivity" android:screenOrientation="landscape" android:configChanges="keyboard|keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.READ_INPUT_STATE"/>
<uses-permission android:name="android.permission.SET_ORIENTATION"/>
</manifest>
Where do I put in this:
<supports-screens android:smallScreens="false" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
and is this the correct syntax to not show the application to people with fail phones on the market? I just want to show my app to people with a decent dpi screen as i guess it helps determine how fast their processor is, how much ram they might have etc.
Cheers guys!
I think it places on Just before "application" tag
It must be a manifest child.
http://developer.android.com/guide/topics/manifest/supports-screens-element.html
http://developer.android.com/resources/samples/ApiDemos/AndroidManifest.html
see the supportScreens section.