Android Intent Category CATEGORY_BROWSABLE - android

I want to add a web page navigation Activity in my Android application, and I find that I need to use CATEGORY_BROWSABLE. The description says:
By supporting this category, you are promising that there is nothing damaging
(without user intervention) that can happen by invoking any matching Intent.
Can someone tell what risk is Android is trying to highlight here ? What could be damaging in handling web page navigation ?

Operations such as invasive edits to an account, deleting contacts and text messages, downloading files without user permission, etc. are considered damaging without user intervention.
As this category can be added to any activity (webview-based or not), the line you quoted is meant as a general rule of thumb for developers who decide to flag their activities (webview-based or not) as BROWSABLE.

Related

Is it possible for a Flutter for Android activity to NOT be fullscreen? Or have no UI at all?

I'm building a somewhat basic app (only testing on Android for now) with multiple lists, one of which is an Inbox list. I can share text from other apps to my app, and it works well.
However, I would like the app to handle the intent without launching the full app UI. For example, if I share a URL from the browser to my app, I would like it to be handled in the background, save the URL to Firestore, and show a toast to the user indicating that it was successful.
Ideally, I would like to put two entries in the share menu, one to add to the Inbox and show a toast as described above, and a second entry that gives the user a modal dialog that floats above the sharing-from app, which allows the user to choose a different list to save to.
I think I'll have to make a (for example) ShareActivity.java, and add it to AndroidManifest.xml, but I have no idea where to go after that, or even if that's the right approach.

Android share menu : apps ordering

I made an Android app which can receive text via ACTION_SEND intents from other apps. However, when I try to share content from another app, my app is in the bottom of the long list of available apps. It's not alphabetically ordered because my app begins with "A". So how can I do to raise the position?
The order of options is controlled by the UI showing those options. That might be a system-supplied UI (e.g., platform default chooser) or an in-app API (e.g., ShareActionProvider). You have no means of guaranteeing your app's position in those options in either case. Whether they use alphabetical order, frequency of use, or other criteria is up to their developers, not you.

Android App Index - Expiring Content

I can't seem to find any literature on expiring content with Android's App Indexing feature.
Let's say you have an app that shows users information on store sales. The store sales are time sensitive - they will eventually expire, and no longer be available. While the sale is available the user can see related search results because the app has used App Index to declare them. Eventually, the sale expires though. The content is presumably still in the App Index, but it's now dead from the perspective of the app.
How does one deal with this? Is there a way to explicitly remove content from App Index? Are App Index entries automatically expired if not declared again within a given timeframe?
The app index entries won't get expired on their own. They will be always visible in the history.google.com of that particular user. So you have to create a mechanism to gracefully handle your case. You can check for the timing in the code that handles the deep-link and take action according to that.
I believe the main question was how to remove deep links from App Indexing in the cases that the Web URLs linked is no longer available due to be time sensitive.
Now regarding your deep links to stop appearing in Google Search results, there are a few options to handle these time-sensitive issues:
1- Use the "unavailable_after" robots meta tag as explained here https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag?hl=en / https://googleblog.blogspot.it/2007/07/robots-exclusion-protocol-now-with-even.html
2- Add a noindex robots meta tag and inform Google about the page-change via the sitemap file
3- Just remove the page (or add a noindex), and Google will recrawl it after a while automatically.
Apart from this, I would recommend you to implement an exception handling for the cases that the App can not obtain any content from the server. You probably can use the HTTP error 404 for that.

To show other Apps while exiting

I wish to show my other apps under "More Apps" section of while exiting.
What is the the best way to do it ?
Is there is any common library to add my app icon and link of my app. so that It can be shown at the time of interest. It would be great if it is scrollable
Thanks is Advance !
Well since these are your apps you can simply hard-code the icons into a RecyclerView or ListView along with a link leading to Google Play. This really doesn't require a third-party liubrary as it can easily be done by yourself.
If you really want to allow for future expansiveness, you could use a cloud platform like parse where you store the names of different apps as parse objects along with a link and an image (logo). Then you could write a custom adapter for your list which takes the parse objects from your cloud, and populates itself with the logo,link,title,etc.
This is really a matter of comfort and preference rather than finding a library to do this for you. If you need help, feel free to ask, and good luck!
You can show a 'Dialog' asking if the user cares to check some of your other apps with two available options: 'yes' and 'no'. If the user chooses
'no', close the dialog, if he chooses 'yes' - redirect him/her to the following url:
https://play.google.com/store/apps/developer?id={Your-Google-Account-Name}
This link will be opened either in the browser or in the Google Play app, whichever your user prefers, and it'll show him/her the list of all your apps.
You can try overriding finish() (Documentation) method inside your Activity. If you're using multiple Activities, consider creating a base Activity so that you don't have to implement this in each Activity.
That said, please consider not doing this. As a user, I'd be super annoyed if I'm trying to close your app and you're not letting me do it. That'd be instant uninstallation from my side. Never annoy your users. Respect their experience.

Restrict activities or android component based on user profile

I am writing an application where, after successfull login and based on the user profile, the user can only see certain activities. For instance, if user has profilA, he can only see Activities A, B, C. If he has profilB, he can only sees Activities D,F,G.
Note that I could write 2 applications and my problem is solved easily but the requirements are the app should manage profileA and profileB.
I was thinking about custom permissions to implement this. Where each activity will be restricted with a custom permissions. For instance, Activities A,B and C would be restricted with com.myapp.permissions.profilA. And Activities D,F and G would be restricted with com.myapp.permissions.profilB.
While searching again, I have found the permission-tree element and the PackageManager.addPermission(PermissionInfo info).
The javadoc of addPermissionsays :
Add a new dynamic permission to the system. For this to work, your package must have defined a permission tree through the tag in its manifest. A package can only add permissions to trees that were defined by either its own package or another with the same user id; a permission is in a tree if it matches the name of the permission tree + ".": for example, "com.foo.bar" is a member of the permission tree "com.foo".
The idea that I have is, define a permission-tree, after successfull login, based on the user profile, "sets the custom permissions" of the application. I don't know if it's possible.
It's a similar feature when certain apps hide some admins features to their users. I am thinking of similar functionality.
Is it possible to achieve this functionality? Or do I need to think for another solution?
I am open to all propositions.
There is an easier way to go about about. In your API, create a user_code for each user so that after a successful login, you can get the user_code for the currently logged in user. Once you get the code say in the Home/Dashboard Activity, you can check if the user is allowed to access a certain activity and if they are not allowed, you can probably return an alert dialog telling them that they don't have the rights.
It seems that defining custom permissions to restrict access to certain activities is not exactly what you need. Seems to me that you're going on the wrong direction...as the documentation states...creating custom permissions is relatively uncommon...I mean permissions were designed to reduce security issues and sandbox applications from each other....the latter doesn't seem to be your case.
Anyway, it is extremely uncommon...IMHO, to create custom permissions for the mere purpose to restrict access to certain activities. Especially, because the same way you login a user and the same way you determine what a specific user is allowed to do...it's exactly the same way you can determine when to restrict access to a specific part of your app
Not really sure why you would need to rely on the permission system to do this. What I'm thinking is that you can just create logic to disable whatever features that would lead to those Activities from being launched based on the logged in profile.
If your activities don't have any filters that would allow them to be launched implicitly by another intent, then that means your app complete control over when they're launched.
Use the login result to control what you display to the user. If you wanted to, you could create two separate XML layout files. One that has buttons for A, B, and C, and the other that has buttons for D, E, and F.
Just because an Activity exists doesn't mean it's automatically displayed to the user as an "entry point". You're doing that through what you display in other activities.

Categories

Resources