By default iOS is providing "Share appname" option in the shortcut options,when the app is downloaded from the app store.
Refer the image below:
When clicked on it,it is opening the share intent in the phone menu screen itself,without redirecting to the app,where the user can share the app.
I want to implement this in android.
Here is what I have I tried so far:
<shortcut
android:shortcutId="share_app"
android:enabled="true"
android:icon="@drawable/ic_cart_active"
android:shortcutShortLabel="@string/shortcut_share"
android:shortcutLongLabel="@string/shortcut_share">
<intent
android:action="android.intent.action.send"
android:targetPackage="com.example.android.internal"
android:targetClass="" />
</shortcut>
But this is not working,since I am not able to understand, what should be the targetClass over here.
EDIT: Nilesh`s answer almost worked,but the only problem that I am facing right now is,whenever I am clicking the share button from shortcut, the launcher activity is shown for a whisker of a second ,then the sharing intent chooser is showing up.Now when I am pressing the home button with the sharing options showing,the app is going to background.This should not happen.Any idea how to avoid this.
from Share intent option using Shortcut android



No comments:
Post a Comment