android-permissions

Call requires API level 23 (current min is 14): android.app.Activity#requestPermissions,checkSelfPermission [duplicate]

天大地大妈咪最大 提交于 2019-11-30 00:43:19
This question already has an answer here: The method checkSelfPermission(Context, String) is undefined for the type ContextCompat 3 answers I am trying add run time permissions android(6.0.1) API 23,If I use SDK version( min and target version both 23 ) it woks fine, like below, <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" /> If I change android:minSdkVersion(less then 23) For example: I am getting error below: Call requires API level 23 (current min is 14): android.app.Activity#requestPermissions,checkSelfPermission For following 2 methods, 1)requestPermissions

How do I use adb grant or adb revoke?

≡放荡痞女 提交于 2019-11-29 20:36:38
The Android documentation contains the following description of the adb grant and adb revoke commands. grant <PACKAGE_PERMISSION> Grant permissions to applications. Only optional permissions the application has declared can be granted. revoke <PACKAGE_PERMISSION> Revoke permissions to applications. Only optional permissions the application has declared can be revoked. Can anybody please give an example of the correct syntax to use them? I assume that would be a permission like android.permission.WRITE_EXTERNAL_STORAGE , or perhaps just WRITE_EXTERNAL_STORAGE . Well I tried those, and several

SMS Messages of a particular number not showing up on other devices Android

做~自己de王妃 提交于 2019-11-29 18:49:32
I am using the Telephony.Sms library to load in received and sent sms messages for the app I am working on. When I set the query selection to null (the third item in the query), it will show all the sent and received sms messages on the different types of phones I have been testing on. Cursor c = cr.query(Telephony.Sms.CONTENT_URI, null, null, null, null); But when I set it to a particular number, on the Samsung S9 phone running on API 27 it is not showing any sms messages. On the Nexus runnning on API 23, it will show the received messages but not the sent messages in the listview. On the

Can't write to external storage unless app is restarted after granting permission

微笑、不失礼 提交于 2019-11-29 18:32:55
问题 App unable to write to external storage on Android 6.0 (I'm testing on emulator), even after WRITE_EXTERNAL_STORAGE has been granted at runtime; unless the app is killed and restarted. Snippet from AndroidManifest.xml <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> build.gradle android { compileSdkVersion 23 buildToolsVersion "23.0.1" defaultConfig { ...... minSdkVersion 15 targetSdkVersion 23 } Whenever I need to write to external storage (for backup) I check

WebView WebRTC not working

試著忘記壹切 提交于 2019-11-29 18:26:33
问题 I'm trying to show WebRTC chat in WebView . Related to this documentation WebView v36 supports WebRTC . For my test i'm using device with Chrome/39.0.0.0 and added permissins to manifest: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <user-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> but when entered into chat see chromium

Read and Write permission for storage and gallery usage for marshmallow

匆匆过客 提交于 2019-11-29 17:50:49
问题 I am developing an android app in which it is required to provide permission for Read and write external storage. My requirement is to select a picture from gallery and use it in my app. Everything is working fine except Marshmallow devices. I want to provide permission for Marshmallow. Can anyone help me with this? 回答1: It can be achieved something as following... public class MainActivity extends AppCompatActivity implements ActivityCompat.OnRequestPermissionsResultCallback{ private static

Call 911 in Android

孤者浪人 提交于 2019-11-29 17:49:27
问题 I want to call Emergency number using Android SDK. I am using following code to call the number (911). This code works fine for all the numbers except 911 (Emergency Number). When I use 911, then it shows the dialer screen that I don't want. Is there any procedure to call 911 without open the dialer or can we stop the user to edit the number in Dialer screen? Uri callUri = Uri.parse("tel://911"); Intent callIntent = new Intent(Intent.ACTION_DIAL,callUri); callIntent.setFlags(Intent.FLAG

How can i Use External Storage in android

耗尽温柔 提交于 2019-11-29 16:21:21
This is for the first time i am using external storage in android. I need some help how can i perform different operations such as how to check whether External Storage is available or not?, How to write files or pictures into storage . how to check whether External Storage is available or not? Use Environment.getExternalStorageState() . How to write files or pictures into storage Use standard Java I/O, working off a directory built using Environment.getExternalStorageDirectory() . To clarify the first part of CommonsWare's answer (I couldn't seem to add a comment to the comment stream): you

How to grant permission Manifest.permission.MANAGE_DOCUMENTS android 6.0

风格不统一 提交于 2019-11-29 15:29:18
I want to grant the permission Manifest.permission.MANAGE_DOCUMENTS , but when I run the app, the dialog of the permission should appear but it doesn't. Here's my code: int hasCameraPermission = ContextCompat.checkSelfPermission(MemoryDetail.this, Manifest.permission.MANAGE_DOCUMENTS); if (hasCameraPermission != PackageManager.PERMISSION_GRANTED) { if (!ActivityCompat.shouldShowRequestPermissionRationale(MemoryDetail.this, Manifest.permission.MANAGE_DOCUMENTS)) { showDialogMessage("Need use permission: MANAGE_DOCUMENTS", new DialogInterface.OnClickListener() { @Override public void onClick

Using osmdroid without getting access to external storage

荒凉一梦 提交于 2019-11-29 13:53:23
In my app I am using osmdroid for working with map. Map tiles are downloaded and kept in /storage/osmdroid . The application requires permissions WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE . If I deny access to storage, map is not shown. Is any way to show map without access to phone memory? https://github.com/osmdroid/osmdroid/wiki/FAQ Fresh off the wiki press. Yes you can change the location to application private storage, in which case it should work just fine. Pro tip: set these before loading any map views. OpenStreetMapTileProviderConstants.setCachePath(...)