Music Player app not displayed in the "open with" section - android

I am creating this android music player in flutter android and there is a problem in that my app is not displayed in the open with section when a music file is clicked in files.
I have written this android manifest code that according to blogs and stack overflow questions should work however its not.
<application
android:name="io.flutter.app.FlutterApplication"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:label="Stoned Piper">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:theme="#style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!--
This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in #style/LaunchTheme).
-->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<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" />
<data android:scheme="file" />
<data android:mimeType="audio/*" />
<data android:mimeType="application/ogg" />
<data android:mimeType="application/x-ogg" />
<data android:mimeType="application/itunes" />
</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:scheme="http" />
<data android:mimeType="audio/*" />
<data android:mimeType="application/ogg" />
<data android:mimeType="application/x-ogg" />
<data android:mimeType="application/itunes" />
</intent-filter>
<intent-filter android:priority="-1">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content" />
<data android:mimeType="audio/*" />
<data android:mimeType="application/ogg" />
<data android:mimeType="application/x-ogg" />
<data android:mimeType="application/itunes" />
</intent-filter>
</activity>
<service
android:name=".AppPlayer"
android:enabled="true"
android:exported="false" />
</application>
I expected the code to fix it but the app still doesn't show in the open with section.

Related

Element intent-filter is not allowed here-Android Studio

I was adding some text editor utilities to my application. Everything was complete and the last was to write the activities to the manifest. This requires some intent-filters for the the main text editor activity but Android Studio says "Element intent-filter is not allowed here" and now i can't sync nor build the app because of this problem. Here's the part of the code that contains the activity:
<activity
android:name=".GrimEditorActivity"
android:label="#string/GrimAppName"
android:launchMode="singleTop"
android:configChanges="locale" />
<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:mimeType="text/plain" />
<data android:scheme="file" />
<data android:host="*" />
</intent-filter>
<intent-filter>
<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:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.txt" />
<data android:pathPattern=".*\\.html" />
<data android:host="*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable"/>
NOTE: This is not the main activity nor the launcher of this app, its an utility builtin. If there's a misunderstanding or help possible, please respond to the topic.
Because your activity tag is being ended only at start. You need to remove closing /.
<activity
android:name=".GrimEditorActivity"
android:label="#string/GrimAppName"
android:launchMode="singleTop"
android:configChanges="locale"> //You have end tag here.
your intent filters..
</activity> // close activity tag.
You also need to add ending </activity>as shown.
Try This One:
<activity
android:name=".GrimEditorActivity"
android:label="#string/GrimAppName"
android:launchMode="singleTop"
android:configChanges="locale">
<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:mimeType="text/plain" />
<data android:scheme="file" />
<data android:host="*" />
</intent-filter>
<intent-filter>
<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:scheme="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.txt" />
<data android:pathPattern=".*\\.html" />
<data android:host="*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="#xml/searchable"/>
</activity>

How can I add my pdf Reader app as an implicit intent when a user clicks a pdf file from another app, like a file manager app?

I've been trying to add my PDF reader app as an implicit intent when a user clicks a pdf file from the file manager app, but my app doesn't show as an option to open that pdf file, instead only other apps like Adober Reader, and Google Reader show.
How can I do that, I already tried adding the intent filter in the activity in the manifest.xml, but it doesn't work.
I will show the the manifest.xml file as I have tried until this moment, but still don't getting the expected result.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity android:name=".ActivityPdfView" >
</activity>
<activity android:name=".ActivityMain" >
</activity>
<activity android:name=".ActivitySplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern=".*\\.pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="http" />
<data android:host="*" />
<data android:mimeType="application/pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.pdf" />
</intent-filter>
</activity>
<activity
android:name=".ActivitySetting"
android:label="#string/title_activity_setting" />
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent" />
<!-- This meta-data tag is required to use Google Play Services. -->
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern=".*\\.pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:mimeType="application/pdf" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.pdf" />
</intent-filter>
</application>
</manifest>
You have three <intent-filter> elements that are immediate children of <application>. Those will be ignored. If you want an <intent-filter> to trigger an <activity>, the <intent-filter> needs to be a child of that <activity>.
None of your ActivitySplash <intent-filter> elements are likely to be used. If you want to respond to ACTION_VIEW, you use <action android:name="android.intent.action.VIEW" /> and <category android:name="android.intent.category.DEFAULT" />, not <action android:name="android.intent.action.MAIN" /> and <category android:name="android.intent.category.LAUNCHER" />.
Since file Uri schemes have been largely banned since Android 7.0, any file <intent-filter> is unlikely to be used. Add an <intent-filter> for a content Uri and the application/pdf MIME type for greater compatibility.
Since http Uri schemes will be unusable by default on Android P, make sure that you support https in addition to http.

How to Show App's Name in "Completing action using" menu?

I tried to use implicit intent to open my android app. It almost works, my app icon really appears in the menu "completing action with". However, instead of showing the real app name, as all the other applications do, the name appeared below the icon of my app is the package name, like "com.example.xxx", which is not quite user friendly. Where can I define this name?
Here's the code I used in the manifest xml:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.testImplicitIntent.MainActivity"
android:label="#string/app_name" >
<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.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern=".*\\.txt" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:mimeType="application/txt" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.txt" />
</intent-filter>
</activity>
</application>
There is some problem with your #string#/app_name
Inside the intent filter in each intent filter give the android label
<activity
android:name="com.example.testImplicitIntent.MainActivity"
android:label="#string/app_name" >
<intent-filter android:label="#string/app_name" >
<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.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:pathPattern=".*\\.txt" />
</intent-filter>
<intent-filter android:label="#string/app_name" >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="http" />
<data android:host="*" />
<data android:mimeType="application/txt" />
</intent-filter android:label="#string/app_name" >>
<intent-filter android:label="#string/app_name" >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:host="*" />
<data android:pathPattern=".*\\.txt" />
</intent-filter>
</activity>

Application Icon Not Displayed In Android

I have added my application in Share Menu .It is working perfectly When i am running the application. But application icon is not displaying in screen.Please help me to solve this problem.
Here is my manifest
<application
android:allowBackup="true"
android:icon="#drawable/gdrivelogo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.vishwak.gdrive.activities.GDriveLoginActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="application/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="image/*" />
<data android:mimeType="message/*" />
<data android:mimeType="multipart/*" />
<data android:mimeType="text/*" />
<data android:mimeType="video/*" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.vishwak.gdrive.activities.MainActivity"></activity>
</application>
We can use
<activity
android:name="com.vishwak.gdrive.activities.GDriveLoginActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="image/*" />
<data android:mimeType="message/*" />
<data android:mimeType="multipart/*" />
<data android:mimeType="text/*" />
<data android:mimeType="video/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
to solve that issue.

Application not called when i click a link

I'm developing an android app and I would like to open my application when a link for file download on a certain website is clicked. I've read some guides for Android manifest file and this is the manifest I'm using:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ada"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET"/>
<application android:label="#string/app_name" android:icon="#drawable/ic_launcher">
<activity android:name="MyApp"
android:label="#string/app_name">
<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" />
<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="application/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="image/*" />
<data android:mimeType="message/*" />
<data android:mimeType="multipart/*" />
<data android:mimeType="text/*" />
<data android:mimeType="video/*" />
<data android:scheme="https"
android:host="my.subdomain.com" />
</intent-filter>
<intent-filter>
<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="application/*" />
<data android:mimeType="audio/*" />
<data android:mimeType="image/*" />
<data android:mimeType="message/*" />
<data android:mimeType="multipart/*" />
<data android:mimeType="text/*" />
<data android:mimeType="video/*" />
<data android:scheme="http"
android:host="my.subdomain.com" />
</intent-filter>
</activity>
</application>
</manifest>
The problem is that when I browse my.subdomain.com/somefile.ext (with https or http), a download starts without asking me if I want to open the link with my app.
What am I missing?
You probably have to define the scheme attribute (https://developer.android.com/intl/es/guide/topics/manifest/data-element.html)

Categories

Resources