Sherry
Lost but trying
Profile
Posts: 129
Reg: Jan 05, 2013
South Africa
11,590
10/28/18 01:28 PM (2 weeks ago)

What code must I write to get permission code for Read and Write External Storage to work on Android SDK 26

I have been trying to figure this out but am really struggling and so far every solution I’ve tried from Google has resulted in an error when I try to compile my app that’s why I’m reaching out here. I use the standard BT pdf plugin on Android but when I compile the app on SDK 26 without adding in any runtime permissions, only permission in the manifest file the pdf file doesn’t download or open within the app so the reason why I need to add a permission but am just not sure exactly what to type and where to type it.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
10/31/18 07:12 PM (2 weeks ago)
I've found that even though I'm using Android Studio, I need to modify the manifest just like we did using Eclipse.

For external storage, ensure you've included the line to 'write' to external storage. here's a whole list:

<!-- generic device permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BLUETOOTH" />

Also remember, a PDF is not 'built in' to android, you need a PDF viewer of some kind, and (depending on the kind of engine it is) you have to explicitly allow it to run from within your app. Something along the lines of:

<activity android:name="Your_pdfViewerActivity_name"></activity>

Hope this helps.

Cheers!

-- Smug
 
Sherry
Lost but trying
Profile
Posts: 129
Reg: Jan 05, 2013
South Africa
11,590
like
11/02/18 12:27 AM (2 weeks ago)
Thanks so much Smug, I'll give this a try.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.