Associate file extension with air app on Android - android

I am trying to associate a file extension with my air app on Android. My goal is to be able to start my app by clicking on a file with a specific file type from either a file manager or mail app. I have found a solution that in theory would work in native, but does not with air somehow.
In the .xml-file for the app, under the tag I have written:
<activity>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" />
<data android:pathPattern=".*\\.csml" />
<data android:host="*" />
</intent-filter>
</activity>
Does anyone have an idea how this could be solved?
Thanks in advance
Jens

Adobe AIR currently doesn't support intents, here the feature request for it.

Related

How to register a react native mobile app with the default existing URL Schema tel for telephone custom dialer

Our teams goal is to have a customer dialer app on mobile phones b/c we want to mask the phone number for our users. They dont want their personal real numbers on caller ID. We have a phone service to do this behind the scenes (Twilio), but need to have our native app register as responding to the "tel" URL Schema and hooked into the React Native Deep LInk APis.
https://reactnative.dev/docs/linking#built-in-url-schemes
We have setup and followed the normal tutorials for custom URL schemas, like "myawesomeapp:/phone/+12223334444"
and we can get that to open.
We want the app to register as a main dialer app though, when we do not control to setup this custom url. So anywhere there is a link for +12223334444 we want the OS to offer our app vs the main phone app when user clicks on this link.
Any tutorial on this? How to do this in Android and iOS using React Native. We started with expo default react native project, but ejected it and have full control of native settings. Thanks!
This tutorial was userful or the custom schema, but not "tel"
https://rossbulat.medium.com/deep-linking-in-react-native-with-universal-links-and-url-schemes-7bc116e8ea8b
had the same problem. I added these intent filters to the AndroidManifest file
<intent-filter>
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</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:mimeType="vnd.android.cursor.dir/calls" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.DIAL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="tel" />
</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="https" android:host="*ashnamoon.ir" android:path="tel/*" android:pathPrefix="/"/>
<data android:scheme="http" android:host="*ashnamoon.ir" android:path="tel/*" android:pathPrefix="/"/>
<data android:scheme="ashnamoon" android:host="*ashnamoon.ir" android:path="tel/*" />
</intent-filter>
clicking on the links below will suggest my app and you can get the data with Linking API of react-native you can read about here.
test this link https
test this link http
test this phone
test this link https
test this link http
test this link ashnamoon
I add some links that helped me. this will only solve the problem on android not sure how can it be done in ios though
https://developer.android.com/reference/android/content/Intent
https://android.googlesource.com/platform/packages/services/Telecomm/+/a06c9a4aef69ae27b951523cf72bf72412bf48fa/AndroidManifest.xml

Intents for Specific Web Sites - Android

I would like my app receive intents if a specific link is shared from other apps. For example, the link is youtube. There are a couple links for youtube.
www.youtube.com/...
m.youtube.com/...
youtu.be/...
If any of these links are shared, either from youtube app, or chrome or some other app, I want my app to be on the share list. Otherwise I don't want it to be shown at the share list. I think I've seen some apps do this but I'm not sure how.
I added these codes to manifest file but on chrome every link can be shared to my app.
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="www.youtube.com" android:mimeType="text/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="m.youtube.com" android:mimeType="text/plain" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:host="youtu.be"
android:mimeType="text/plain" />
</intent-filter>
I can handle the link with the code in the activity file, but I'm looking for another way to limit the links with the ones I specifically give.
I'm a newbee on Android so forgive me if this question sounds a little bit off.
Thank you,
What you want is not possible. You cannot filter on a value in an extra (e.g., EXTRA_TEXT or EXTRA_STREAM).

Google Chrome ARC intent-filter crash

I try to implement launch app from intent filter on ARC using that code :
<activity
android:name=".package.etc.MyActivity"
android:configChanges="mcc|mnc|locale|touchscreen|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|layoutDirection|fontScale"
android:screenOrientation="sensorLandscape"
android:launchMode="singleTask"
android:label="#string/myactivity_name" >
<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="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.pdf" />
<data android:host="*" />
</intent-filter>
</activity>
On Android Tablet, it works. But on Chrome ARC app crashes.
Is Chrome ARC supports that ?
EDIT
I got that crash
Fatal Exception: java.lang.IllegalArgumentException There is no Activity which handles filePath = file:///data/data/org.chromium.arc/external/C1373AC2527597D1C0BC66486DCC787F/Gra‌​nizo.pdf mimeType=application/pdf
org.chromium.arc.helper.FileHandlerLaunchHelperActivity.buildLaunchIntent (FileHandlerLaunchHelperActivity.java:122)
org.chromium.arc.helper.FileHandlerLaunchHelperActivity.onMessage (FileHandlerLaunchHelperActivity.java:162)
org.chromium.arc.ArcMessageBridge$1.handleMessage (ArcMessageBridge.java:75)
org.chromium.arc.ArcMessageBridgeService$3.run (ArcMessageBridgeService.java:238)
EDIT 2
<activity
android:name="com.package.activities.MyActivity_"
android:configChanges="mcc|mnc|locale|touchscreen|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|layoutDirection|fontScale"
android:screenOrientation="sensorLandscape"
android:launchMode="singleTask"
android:label="#string/myactivity_name" >
<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="file" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.pdf" />
<data android:host="*" />
</intent-filter>
</activity>
I am going to assume that whatever "ARC file explorer" is refers to some other Android app, packaged via ARC, that is running in your Chrome/ChromeOS environment.
In that case, that app has nothing to do with your app.
It is best to think of ARC as providing separate Android emulators per ARC. Apps in one ARC do not have access to apps in other ARCs, just as apps in one emulator image do not have access to apps in other emulator images (or apps on one device do not have access to apps on a separate device). Hence, your "ARC file explorer", in its own ARC, cannot open a PDF via your app in a separate ARC.
This makes many Android apps fairly useless in the ARC environment, and hopefully is something that will be addressed in the future.

Can't get Android Firefox to open files with a mime-type specified

I want my app to handle files called *.mcmidi from browser, email or storage.
I have found that the following intent-filter data element works for android native browser and for android chrome:
<data android:scheme="content" android:mimeType="*/*" android:pathPattern=".*\\.mcmidi" />
and this works for android firefox:
<data android:scheme="file" android:pathPattern=".*\\.mcmidi" />
but if I try to use both then firefox stops being able to open the downloaded files. It seems like firefox doesn't work if any intent-filter specifies a mimeType.
(I've been testing so many combinations of these intent-filters trying to find one that works everywhere)
Does anyone know why firefox is doing this, or any way to work around it?
Ok I worked it out. Chrome and Android browsers use the scheme="content" entry. Firefox uses the scheme="file" entry. If you use the mimeType="*/*" entry then all new email alerts will open the app chooser with my app, which is also no good. Opening file attachments from gmail use scheme="content" but with a different mimeType. File explorer apps generally use scheme="file" with the path extension.
Because they all need different intent-filters, I have used activity-alias to alias my activity three different ways for the different apps, so that they all pass the file content to my app and don't interfere with each other or add themselves as generic file handlers (which is always very irritating). So I have this:
<activity
android:name="my.Activity"
android:label="#string/label1"
android:exported="true" >
<!-- the main intent filter allows chrome and native browsers to open .mcmidi files with my app -->
<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="content" android:mimeType="application/x-mcmidi" android:pathPattern=".*\\.mcmidi" />
</intent-filter>
</activity>
<!-- This alias will cause file explorer apps to open *.mcmidi files with my app -->
<activity-alias
android:name="my.ActivityFileAlias"
android:targetActivity="my.Activity"
android:label="#string/label1"
android:exported="true" >
<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="file" android:pathPattern=".*\\.mcmidi" />
</intent-filter>
</activity-alias>
<!-- This alias will cause gmail and the native mail apps to open *.mcmidi files with my app -->
<activity-alias
android:name="my.ActivityEmailAlias"
android:targetActivity="my.Activity"
android:label="#string/label1"
android:exported="true" >
<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="content" android:mimeType="application/octet-stream" android:pathPattern=".*\\.mcmidi" />
</intent-filter>
</activity-alias>
Which I worked out with a few clues and loads of trial and error. Hope it helps someone.

Cannot download unknown extensions

I cannot download (from web & from e-mail) unkwown extentions such as (*.ini, *.zip, *.ddd)
unless there exists an app that can understand the extention.
For example, I couldn't download *.ini file from the browser (or email) until I downloaded 'Astro' app.
How can you by pass so that they are downloadable?
How can you register your app to understan certain extention so that it can be downloadable?
How can you by pass so that they are downloadable?
You don't.
How can you register your app to understan certain extention so that it can be downloadable?
Ideally, you don't. You do it by MIME type. File extensions are very fragile. However, either can be achieved via the use of the <data> element in your activity's <intent-filter>. You will also want the BROWSEABLE category and probably the VIEW action.
For example, here is how you would arrange to be an option for viewing PDF files:
<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="application/pdf" />
</intent-filter>
<activity
android:name=".Main"
android:label="#string/app_name">
<intent-filter>
<action
android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
<category
android:name="android.intent.category.DEFAULT" />
<category
android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="file" />
<data
android:pathPattern=".*\\.ini" />
<data
android:host="*" />
</intent-filter>
</activity>
Above code allowed me to download *.ini files.
Thank you for your help.

Categories

Resources