2015-10-29 114 views
0

在最近版本Spotify的Android应用(3.9.0.965在写作的时间)Share -> Send to菜单显示的选项的定制名单:从Spotify的Android应用程序共享的轨道与我的应用程序

Select RecipientEmailSMS,然后列出其他应用程序(WhatsApp,环聊等)。

我可以将我的应用程序放到该列表中吗?我希望能够与我的应用分享Spotify曲目并播放它。

回答

2

是否有可能,我让我的应用程序在该列表中?

没有,可惜这是不可能的,即使你的清单是否正确配置,你不能看到你的应用程序,当你选择Share -> Send to因为Spotify的将只显示一组预定义的应用程序(的WhatsApp,Facebook的信使,视频群聊)的。

例如,我们有一个包装名称com.example.spotify的应用程序。收藏此intent-filterAndroidManifest.xml

<intent-filter> 
    <action android:name="android.intent.action.SEND"/> 
    <category android:name="android.intent.category.DEFAULT"/> 
    <data android:mimeType="text/plain"/> 
</intent-filter> 

运行的应用程序,但如果我们选择Share -> Send to应用程序将不会出现。

现在改变applicationId到白名单包名称之一(com.whatsappcom.facebook.orcacom.google.android.talk)在我们的build.gradle:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.1" 

    defaultConfig { 
     applicationId "com.whatsapp" 
     minSdkVersion 15 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

现在,应用程序可以在Share -> Send to上下文菜单,就好像它是WhatsApp的,你可以在这个截图中看到:

enter image description here

WhatsApp的选择我们的应用程序能正确打开并接收来自Spotify的意图。

+0

我怀疑这可能是这种情况。谢谢。 –

0

您需要在清单中提供的活动(SomeShareActivity),并提供IntentFilters它

<activity android:name=".SomeShareActivity"> 
    <intent-filter> 
     <action android:name="android.intent.action.SEND" /> 
     <category android:name="android.intent.category.DEFAULT" /> 
     <data android:mimeType="audio/*" /> 
     <data android:mimeType="video/*" /> 
    </intent-filter> 
</activity> 
+0

对不起,这不起作用。 –

相关问题