I was trying to implement "Share App" facility as App Shortcut in Android (like iOS platform). This facility must exist immediately after installing even without opening app. I want to know how I can use this intent in shortcut xml file:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "https://www.example.com");
intent.setType("text/plain");
I didn't find any way to put
type
attribute for intent inxml
. But it seems an activity with invisible theme can simulate what I want.As documentation said:
we can add
android:taskAffinity=""
to the InvisibleActivity inmanifest
file to prevent the app from going to background when home button clicked.This is my invisible activity setup in
AndroidManifest.xml
This is the whole
onCreate()
method in my invisible activity:and finally this is my static shortcut xml file: