开发者

Need help fixing a permission error when launching another Activity in a differnt app

开发者 https://www.devze.com 2023-03-17 19:07 出处:网络
Okay Both apps are mine so I can change code in either app.Currently App B hasn\'t been modified in any way and is just a开发者_C百科 regular stand alone app.

Okay Both apps are mine so I can change code in either app. Currently App B hasn't been modified in any way and is just a开发者_C百科 regular stand alone app.

App A goes to call App B using this code:

Intent intent = new Intent(Intent.ACTION_MAIN); intent.setComponent(new ComponentName("net.pawworks.NurseTorando","net.pawworks.NurseTorando.lung")); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent);

I do got it in a catch block for ActivityNotFoundException and deal with that one. but when that exception doesn't happen I get a this permission denied error

there is an activity in the net.pawworks.NurseTorando app that is named lung it's not the one that first comes up if you launch it stand alone. but it's the one i want it to start with when called from app A.

this is the error I get: 07-07 08:47:47.624: ERROR/AndroidRuntime(11129): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN flg=0x10000000 cmp=net.pawworks.NurseTorando/.lung } from ProcessRecord{484bc180 11129:net.pawworks.emergency/10123} (pid=11129, uid=10123) requires null

I can modify the 2nd app, but I still want it to start on a different screen then this when launched by itself. how can I fix this?


Add the following intent filter in the manifest file under the Activity tag (which one you are starting) in AndroidManifest.xml:

OR check if you are having two entries for that activity in your manifest file.

You can refer same posts over here: Android: java.lang.SecurityException: Permission Denial: start Intent

HelloWebView Sample: java.lang.SecurityException: Permission Denial


I'm not sure I fully understand what the problem is, but have you tried editing the AndroidManifest.xml file to give your applications the proper permissions it needs to run? There are a large variety of things you need permission to do on Android and that is the place to make that happen.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号