我已经发布了应用程序,主要任务是将意图转发给其他应用程序。有些用户在向Google + app发送任何内容时都会遇到奇怪的错误:
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.SEND typ=image/jpeg flg=0x3000000 cmp=com.google.android.apps.plus/.phone.PostActivity (has extras) } from ProcessRecord{409b7828 14815:com.andmadesoft.share/10128} (pid=14815, uid=10128) requires null
at android.os.Parcel.readException(Parcel.java:1322)
at android.os.Parcel.readException(Parcel.java:1276)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1351)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1374)
at android.app.Activity.startActivityForResult(Activity.java:2833)
at android.app.Activity.startActivity(Activity.java:2959)
at com.andmadesoft.share.intents.iri.OrdinaryIntentInfo.sendIntent(OrdinaryIntentInfo.java:42)
at com.andmadesoft.share.ShareIntentResolver.resolveIntent(ShareIntentResolver.java:132)
at com.andmadesoft.share.ShareIntentResolver.sendchecked(ShareIntentResolver.java:105)
at com.andmadesoft.share.ShareIntentResolver.access$3(ShareIntentResolver.java:99)
at com.andmadesoft.share.ShareIntentResolver$4.onClick(ShareIntentResolver.java:86)
at android.view.View.performClick(View.java:2538)
at android.view.View$PerformClick.run(View.java:9152)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3691)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
at dalvik.system.NativeStart.main(Native Method)
我无法在任何测试手机上重现错误。希望任何人都可以帮我解决这个错误。
在ShareIntentResolver活动中发送代码部分:
...
Context cont;
protected void onCreate(Bundle savedInstanceState, CharSequence title, Intent target, ArrayList<Intent> extraIntents) {
super.onCreate(savedInstanceState);
cont = this;
...
private void resolveIntent(IntentInfo ii){
ii.sendIntent(cont); // error is got here
}
IntentInfo类:
public void sendIntent(Context context) {
context.startActivity(intent); //intent is just any intent that I am forwarding
}