I should be able to show different activities of my application in the android sharesheet like the example image shown below.
Should I add a new activity? And how is it configured in androidmanifest.xml?
This is the MainActivity part of the androidmanifest.xml, where I have added intent to receive text and images. Now only one icon is shown in the sharesheet.
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
You can add multiple activities and for each activity add an intent filter. You can add label attribute for <intent-filter> to provide a custom label for each activity <intent-filter android:label="My Label 1">
<activity android:name=".BroadcastReceiverActivity1" >
<intent-filter android:label="My Label 1">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
<activity android:name=".BroadcastReceiverActivity2" >
<intent-filter android:label="My Label 2">
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
Related
How to translate the operation of 4 filters to url scheme, please cite source to develop url scheme
<activity android:excludeFromRecents="true" android:exported="true" android:finishOnTaskLaunch="true" android:name="com.google.android.voicesearch.handsfree.HandsFreeActivity" android:noHistory="true" android:process=":search" android:resizeableActivity="true" android:taskAffinity="com.google.android.voicesearch.handsfree" android:theme="#android:style/Theme.NoDisplay">
<intent-filter> <action android:name="android.intent.action.VOICE_COMMAND" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
<intent-filter> <action android:name="android.speech.action.VOICE_SEARCH_HANDS_FREE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
<intent-filter> <action android:name="com.google.android.search.core.action.PROXY_VOICE_BUTTON" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
<intent-filter> <action android:name="com.google.android.search.core.action.PROXY_VOICE_CANCEL" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter>
</activity>
I am trying to recognize the following as a deep link in android
wc:1a15e8b5-8470-47fa-985f-cf11b4c89067#1?bridge=https%3A%2F%2Fbridge.walletconnect.org&key=f92fb2ed74d628a6a286e416e4df2fbfa88d58e6826007c021b9f5920567cdd5
I have set up my AndroidManifest to be as follows:
<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|screenLayout|layoutDirection|keyboard|keyboardHidden"
android:launchMode="singleTask"
android:theme="#style/AppTheme.Launcher"
android:windowSoftInputMode="stateHidden|adjustPan|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wc" />
</intent-filter>
</activity>
However when I try to scan the relevant qr with the camera app, nothing happens.
What am I missing?
I have an app on GooglePlay, but the Open button is missing. It just says Uninstall.
This is my mainfest.xml:
<application
android:name=".preview_refresh"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher_round"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".Login_Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.url.com"
android:path="/launch"
android:scheme="https" />
</intent-filter>
</activity>
</application>
I figured out, the problem is:
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
But I have these lines in my code. When I remove:
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.url.com"
android:path="/launch"
android:scheme="https" />
the open button is shown.
How can I fix it? I need these tags to open my app via link.
EDIT
I solved my problem, but now I have a new question:
Why do I have to separate the <intent-filter>? It's very confusing, because it shouldn't make any difference.
Ok, now I figured it out. The solution is to separate the <intent-filter>. Like this:
<activity android:name=".Login_Activity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.urlk.com"
android:path="/launch"
android:scheme="https" />
</intent-filter>
</activity>
I have an Activity that is both the MainActivity and the activity that should be started when the 'Share'-Button within the Gallery is clicked.
So my Manifest looks like this:
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SEND" />
</intent-filter>
</activity>
With the above manifest, by app appears within the share menu but not in the app drawer. If I remove the line that sets the mimeType the app appears in the app drawer but not within the share menu in the gallery.
Any suggestions how to achieve both?
Thanks in advance.
Use two separate <intent-filter> elements in the <activity>: one for MAIN/LAUNCHER, the other for SEND/DEFAULT/MIME type.
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<action android:name="android.intent.action.SEND" />
</intent-filter>
</activity>
I declared an intent filter in order to open csv files in my Main Activity, since that the app icon
disapeared from my device when I launch it, here is the code in my manifest file :
<application
android:allowBackup="true"
android:icon="#drawable/launcher_ic"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".Main"
android:windowSoftInputMode="stateAlwaysHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter
android:label="#string/app_name"
android:priority="1" >
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<action android:name="android.intent.action.PICK" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="text/csv" />
<data android:pathPattern="*.csv" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host=" "
android:mimeType="text/csv"
android:pathPattern="..csv"
android:scheme="http" />
<data
android:host=" "
android:mimeType="text/csv"
android:pathPattern="..csv"
android:scheme="https" />
</intent-filter>
</activity>
How to avoid this ?
thanks
The app's icon is declared in the application tag of the manifest, not the activity's.
Example:
<application
android:name="com.example.my_app"
android:icon="#drawable/my_app_icon"
android:label="#string/app_name">