What are principles of building URIs on Android platform? - android

Is there any documentation on principles behind using URIs on Android platform? For example, I have an application that allows user to read particular forums. It has a couple of activities - one for viewing list of forums, one for viewing list of threads, one for viewing list of posts, etc.
I'd like to use a hierarchical URI in my activities' intents to indicate what an activity should display. Is it a good idea? If so, what is the best way to formulate those URIs?
For example, should I use my own scheme like myforums: or content: scheme?

Use standard http URIs for viewing public web content and set up your intent filter based on the host/path. Some illustrations of this include Android Market, which will open links to apps on http://market.android.com while the site itself will open in any browser. The YouTube app will open direct links to videos as well.
Using http URIs means that shared links to that content may be opened from any browser on any platform if your app is not present, but the app can take over when it's there to provide a richer or more optimized experience.

Related

In mobile, can different apps respond to a browser call-to-action and open directly?

I'd like to design a cross platform protocol that any app on mobile or app on your desktop can respond to.
On desktop the best example is torrents, where you have a magnet link of the form magnet:?urn:btih:abcabcabcabcabcabcabcabc etc. that can be opened by any app that supports the magnet: scheme. There also exists .torrent files which can be opened by anything that supports .torrents (although this won't open directly).
Is something like this possible on mobile? From my initial research it appears that iOS doesn't let multiple apps register the same uri scheme so customuniversalscheme:// won't work. I also vaguely recall mobile safari opening files in browser and not in separate apps or even being able to download the files, but i'm not sure about that anymore...
What about android? Can multiple apps respond to the same custom scheme? Files can be downloaded on android, but can files be opened directly in browser?
Is the user flow I am thinking about possible on mobile? If so, how? If not, what's the next best alternative?
So I think your comparison with the desktop torrent flow is a bit wrong. On desktop you can choose the default app to open a file or you can "Open With" an app that you want, on mobile it's a little bit different and more complicated.
So mainly on mobile platforms you open an app with a deep-link and iOS has two ways of deep-links:
the old and well known URL scheme that you defined above
the universal-link, this one is used a lot (iOS 9 and above) to forward a link, that usually will be opened in browser, to the app that responds to the universal link (it's very similar to the URL scheme thinghy)
For Android you have something similar using intent-filters and as far as I know it's possible to have multiple apps that respond to the same deep-link, but if I remember correctly the user will be prompted with an app picker (to select which app to use).
Now this is a short summary about deep-links, but from my experience the main issue with deep-links is now how you create them, it's about the app that must "forward" them. For example, on Android there are so many web browsers (not chrome) that won't forward the deep-link to the system in order to check if there is an app that can open them.
Now, if you can pass this problem, what I think you could do to unify the implementation for both platforms is to link your framework/lib/app to an API that will generate a unique deep-link scheme for every app. For example I want to "respond" to your deep-links so I register my app on your platform, with the bundle id and package name (which are unique), and your system will generate a unique combo of package name / bunde id and other number. When your lib/app/framework launch you will fetch all the configured bundles and try to fire a deep-link for each of them, this approach is kind of limited by the number of registered apps.

How can I create Firebase Dynamic-Links by two different links?

I want to create a dynamic link with two different original links.
One original link for Android, e.g: android://mePage/account
One original link for ios, e.g: https://mePage/account
From the docs of Firebase Dynamic-Links, I found there is a optional parameter al, and al=android_link.
So I create a Dynamic Link by manually constructing a URL:
https://myapp.app.goo.gl/?link=https://mePage/account&al=android://mePage/account
But maybe I misunderstand, it doesn't work.I have no way to resolve the android link from the al key.
So:
What does the al parameter really mean?
Any way I can acquire the parameter?
If it does not work, is there any way I can create a Dynamic Link with two different links?
There is a image to show what I saw.
And I found some extra information from another page.
There is no al parameter, did you meant afl? afl specifies the link, where navigation will happens if your App is not installed on Android. So that instead of navigating to PlayStore you can navigate to your page.
Answering your question about Android and iOS specific deep links: we do not have such feature. The same deep link will be passed to Android and iOS Apps.
If you want to separate the data for your Apps, you can use deep link constructed like this:
https://mePage/account?ios=<ios specific base64 data>&android=<android specific base64 data>
Than you can wrap this deep link inside Firebase Dynamic Link.
Not sure this provide enought value, but I do not know your requirements.
If you feel that you need this feature and Firebase Dynamic Links do not support it, feel free to open support ticket or describe your use case here. We always open to improvements and new feature suggestions.
Update
For those who are still looking like me,
as per the docs, https://firebase.google.com/docs/dynamic-links/create-manually
You can specify a different fallback link for IOS/Android using IFL/AFL params.
ifl
The link to open when the app isn't installed. Specify this to do
something other than install your app from the App Store when the app
isn't installed, such as open the mobile web version of the content,
or display a promotional page for your app.
afl
The link to open when the app isn't installed. Specify this to do
something other than install your app from the Play Store when the app
isn't installed, such as open the mobile web version of the content,
or display a promotional page for your app.

Manually open hyperlinks in specific app in Android

I use the Twitter app to follow a lot of news outlets. Each one of them posts links to articles on their websites. I want to open those articles in the news outlet's dedicated Android app. Some of them, like the NYTimes app, does it by itself. But most of them don't. I'm figuring that's because they haven't declared an intent in their app to do so. So basically I want to write an app that would give me an option to redirect the hyperlink of the article to a specific app, and I want to do it for multiple apps. Would it be possible to create a regex that would run on the URL and redirect it to the proper app accordingly?
Would it be possible to create a regex that would run on the URL
That is impossible to state in the abstract. Android's <intent-filter> system does not allow for filtering on all parts of a URL.
and redirect it to the proper app accordingly?
That is impossible to state in the abstract:
There is no requirement for the app for a news site to have any means for outside apps to tell it what to view
There is no requirement for an app's developers to document how to convert a Web site URL to whatever input would be available to tell the app to go view something
So, what you want may be possible for some news apps, but the details would vary by app.
Not that I am aware of - though this is an interesting concept.
Here are some things to know:
the twitter app doesn't care how the intent is resolved. the purpose of the intent is to share external data. once the twitter app has handed over the intent with the url it is up to the android system to decide which app can resolve.
the NY Times app is capable of opening because of this feature: https://developer.android.com/training/app-indexing/deep-linking.html
Workaround:
Learn to develop your own Android ROM to modify the Android Open Source Project adding your logic for intent resolution, compile and get your new Android ROM ready for deploy, install ROM on phone, keep your fingers crossed the entire time.

Android app to view multiple document types

I know this has been asked before but i couldnt find any links here or in web.
I need to open .pdf, .doc, .ppt, .xls document types from our server within my android application without saving the files to device or using options like google viewer because of security reasons.
I know that android does not have built in support for this but i looking for any third party options paid or free for my app
One solution i read about is to package another app (like smart office) with in my app and open the docs using that. Can someone post me more information regarding that (packing apps with in app and opening using intent).
Thanks
I dont know what you've been reading.. But, Android does have support for this, its all about mimeTypes and how you handle those mimeTypes (Intent) in your app. Look at #
http://developer.android.com/guide/topics/manifest/data-element.html
That should get your started.

Handling Deep linking on old Android browsers

I am implementing Deep linking and App Indexing for the first time, its just a month ago it was launched for public use so lack of help online. I have read all available resources, but there are still some problems.
I am clear about things like, Deep linking should be implemented before App indexing, it should implemented android-app//com.example.com schema and many other.
So here the puzzle begins:
Confusions with Deep linking: Google is offering two URL patterns:
http://www.example.com/path/to/something
android-app://com.example.com/example/path/to/something
So almost in every example, I've found they have used both patterns. But for App Indexing only 2nd one is required.
But I know if I implement 1st one as well, it will open my app on normal web link as well. I don't know if this is good do or not?
Another problem with Deep linking, there are many browsers out there(Opera, UC) or Android OS which does't support 2nd format of URI, they simply trigger google search.
So what is the way to make none deep link supported browser to handle this uri: android-app://com.example.com/example/path/to/something?
Note: I will be using this URI Format to open my app from website: android-app://com.example.com/example/path/to/something, so problem is to handle when this url format is not support.
As far as I understand, you can use custom schemes and/or HTTP schemes for your deep links. What you should not do is to duplicate the deep link destination between the different schemes.
You can find an article regarding App Indexing best practices here (https://developer.android.com/training/app-indexing/index.html) and here (http://googlewebmastercentral.blogspot.co.uk/2014/06/android-app-indexing-is-now-open-for.html).

Categories

Resources