Start Activity From Wallpaper Service (not preference related...) - android

I have a live Wallpaper. This live wallpaper has a settings page implemented from PreferenceActivity. Everything works as expected. So far, so good.
From my Wallpaper Settings page..I want to start another activity (a details activity...with info, bitmaps, links, etc...). When I start this activity I get a security exception error:
java.lang.SecurityException: Permission Denial: starting Intent {... } from ProcessRecord ... requires android.permission.BIND_WALLPAPER
The manifest has the required permission. I've tried putting this permission everywhere .. even in multiple locations (not just in the service tag in the manifest). I'm starting the Activity from the wallpaper settings page with a new intent, then calling startActivity.
Does anyone know why I'm getting the permission denial even when the permission is included? Can someone tell me how to start the activity correctly without getting a force close?
Much appreciated.

Related

java.lang.SecurityException: Permission Denial: starting Intent - open settings screen

I want to open settings screen from my app.
I have made app exported = true in Manifest
Besides that I made sure that I pick correct configuration app while running
from this post -> Android - java.lang.SecurityException: Permission Denial: starting Intent
But still got this error
java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.android.settings/.SubSettings } from ProcessRecord{a973751 21451:com.myapp.android.main/u0a157} (pid=21451, uid=10157) not exported from uid 1000
My code of launching the activity is
val intentTwo = Intent()
intentTwo.setClassName("com.android.settings",
"com.android.settings.SubSettings")
startActivity(intentTwo)
I have also tried this one
val intentOne = Intent()
intentOne.setComponent(ComponentName("com.android.settings",
"com.android.settings.SubSettings"))
startActivity(intentOne)
Any ideas on that?
SubSettings is not exported from the Settings app, at least for AOSP and Android 13. For any device configured this way, you cannot start this activity.
Also, please bear in mind that the system Settings app frequently gets modified by device manufacturers. As a result, there is no requirement for any device to even have SubSettings, let alone have it available to be started by external apps.
And, note that SubSettings does not seem to do much.

Permission Denial when using ContentResolver

On Android 10,
I am trying to get data from external apps (like file managers, google photo etc) into my app using this guide -
https://developer.android.com/training/sharing/receive
After receiving the intent in my app, I am trying to open an input stream:
InputStream inputStream = new BufferedInputStream(CGlobals.context.getContentResolver().openInputStream(receivedURI));
It works initially from the Activity specified in the manifest, and even after.
However, I get a Permission Denial error in logcat-
Permission Denial: reading com.google.android.libraries.storage.storagelib.FileProvider uri content://com.google.android.apps.nbu.files.provider/2/721 from pid=19038, uid=10264 requires the provider be exported, or grantUriPermission()
when I am trying to get the input stream from other activities or threads in my app.
After trying for some time, I managed to find that this permission problem appears after I finish the initial activity.
What I can guess from this is, the Android system is granting this permission only as long as the initial activity is not finished.
If what I discovered is true, is this normal or a bug?
Thank you very much.

Unable to catch an event for changing the permission externally

Can anybody tell which method calls, When I change permission of app from SETTINGS page ,When app is in minimized state.?
App Code :https://drive.google.com/file/d/0BxK5c-Q5uNaPOWJycFVtaThxWmc/view?usp=sharing
1)App asked for camera permssion
2)User Granted
3)App minimized
4)Go to setting -->apps -->revoke camera permission Now i need to know which method calls in activity or how to handle the recreation of activity.
NOTE :
Now What happened Presently is App getting Recreating again ,can anybody tell how to stop it.?

Android App is getting recreated when changing the Permission explicitly from setting page

1)Create an app which ask for camera permission.
2)User grant the permission
3)Now minimize the app
4)Go to Setting -> Apps --> Your Application-->revoke the camera permission
5)Now activity getting created ,how to stop recreating .
I found this one but how i can achieve this
Application is getting killed after enable/disable permissions from settings on Android M nexus 6

Android Marshmallow: permissions change for running app

I know, with Android Marshmallow, we have to ask permissions every time we need a functionality that require a permission.
I do this for new App, but for old BIG App is more complicated.
For old BIG App, I ask all permissions in "MainActivity".
So, my app is started and shows a Map Fragment.
I ask for Location Permission with no problem. The user agrees.
The user puts it in background, goes in the App Settings and denies permission.
Then he puts the App in foreground: App crashes!!
I know, there is a problem using Map Fragment.
But the App is too BIG to analyze every single permission.
I need the FAST solution: PERMISSION CHANGE ---> RESTART APP!!!
And this is what GoogleMaps does!
I started GoogleMaps, and put it in background.
GoogleMaps App permissions, the first difference:
in my App, if I denied a permission, I haven't this message showing for Google Maps:
Permission denied
After that, if I put GoogleMaps in foreground, the App restart with no problem:
GoogleMaps restart
I need this for my app. Can someone help me?!?!?!?
Thanks a lot!!
When permissions are revoked, your app is killed and restarted. Look on the logcat when you revoke permission with your application in background. You will see :
I/ActivityManager(572): Killing 13896:com.your.app/uxxxx (): permissions revoked
So you need to only check permissions in your class "myApplication extends Application" in the onCreate() function.

Categories

Resources