且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何打开我的应用程序被点击应用程序链接时,

更新时间:2023-01-01 17:35:45

以下意图过滤器添加到您的活动宣言,​​在项目的Andr​​oidManifest:

Add the following intent-filters to your activity declaration, in the AndroidManifest of your project :

    <intent-filter>

        <action android:name="android.intent.action.SEND"/>
        <category android:name="android.intent.category.DEFAULT"/>

        <data android:mimeType="text/plain"/>

    </intent-filter>

现在,在的onCreate() onResume() onNewIntent()您的活动周期的方法,你可以使用的getData()在意向STRONG> 已经解雇了您的活动。

Now, in the onCreate(), onResume() or onNewIntent() method of your activity lifecycle, you can use the getData() of the intent that has fired your activity.