[英]Find which application launched my Activity
Other applications can select files from my app. 其他应用程序可以从我的应用程序中选择
<activity
android:name="xxxx"
android:icon="@drawable/xx"
android:label="@string/title_activity_select_secure_cloud_drive_file_chooser" >
<intent-filter>
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.OPENABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
I send back the file to the requested app 我将文件发回给请求的应用程序
result.setData(uri);
setResult(Activity.RESULT_OK, result);
everything is working fine. 一切都很好。 Now i need to know who is calling my application?
现在我需要知道谁在调用我的应用程序? eg (mail, dropbox ... etc)
例如(邮件,保管箱......等)
i tried getCallingActivity()
it did not work always returns com.android.documentsui.DocumentsActivity
我试过
getCallingActivity()
它没有工作总是返回com.android.documentsui.DocumentsActivity
can anyone help me find it. 任何人都可以帮我找到它。 I'm using lollipop so the getTask trick won't work.
我正在使用棒棒糖,所以getTask技巧不起作用。 HELP !
救命 !
使用getCallingActivity().getClassName()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.