Android URL intent deep linking like iOS - android

The iOS OS provides this back button on the top of an app that was opened via custom URL schemes. This button generally displays the name of the app that launched the custom URL scheme. This could be seen in the screenshot, "Return to Search". Search is the app that opened the app in foreground now.
I was wondering if we could customise the android action bar, to have a similar effect when my app is opened thorough custom URL intents.
NOTE - I know iOS do not have a back button, and hence this was developed. But displaying the app name, makes it explicit that my app was opened via URL intent by this app. It provides higher visibility to the users.

I was wondering if we could customise the android action bar, to have a similar effect when my app is opened thorough custom URL intents.
No, insofar as you have no way of knowing who started your activity.

The is no way of doing it automatically, but:
Android API lvl 22 introduced a new method getReferrer() to return information about who launched this activity.
By default, it will return a android-app: referrer URI.
For instance, Chrome beta will use android-app//:com.chrome.beta as referrer when launching an app.
You could therefore use this value (it might not be 100% trusted) and query the package manager to get the application label.

You can collect some data that manages user experience, but only in your own environment. For example N apps that interact with each other. If you think closely you will see that knowing who wakes your app up doesn't make sense since the caller can use a broadcast, for instance.

Related

Changing default behaviour of wifi icon - Android

I have an app idea and have a simple question, can I change the behaviour of wifi item on quick settings menu on Android? I want it to redirect to my app. Is this possible?
Not generally.
You can examine Logcat and see what happens when the user taps that tile. If the tile starts an activity (probably yes) and the Intent that is used is implicit (action but no ComponentName or package), then you could create an activity with a matching <intent-filter>. The user would be able to choose to launch your activity instead of the standard one.
However, bear in mind that there is no requirement that the Intent that the tile uses would be the same across Android versions and device manufacturers.

Have an Android HTML5 app listen for intents

I am developing an app that is used by just a couple of people at my work. It's an easier way for them to handle support cases that they get while off-hours. I've created an HTML5 site and made it so that it can be launched fullscreen from their Android phones by using the "Add to Home screen" option within Chrome. That works great. Now, I want to make it so that when they get an email notifying them of an incoming support case, they can click the link for the case and open the app instead of it opening in a regular web browser. Otherwise, the usefulness of fullscreen is lost.
Unfortunately, I just don't know how to do it. Every search I make regarding this brings up information on Intents, but all my searching on intents assumes that I'm developing an Android-native application, not an HTML5 app. Is it possible for apps that are created via the "Add to Home screen" option to listen for intents? If so, where do I begin?
Thanks.
No that is definitely not possible, you will need an Android application which uses an Activity class otherwise you won't be able to listen to react on intents or listen to broadcast receivers...
But you can create a simple application holding a WebView which loads your HTML content. Then you will have the ability to use Intents and Broadcast-Receivers and pass on received information to your HTML content.

Android Wear Custom Voice Actions

I'm making an app that will work with Android Wear,
And I wanted to implement a command into Google's "Ok Google" option.
I saw this page:
http://developer.android.com/training/wearables/apps/voice.html
But it's related only to apps that include Activities in the Android Wear.
I wanted to ask:
Can I add custom commands? I mean, those who does not start with the word "Start"?
Can I add commands that will do another thing than just opening the app? Like running a method?
If it's not the place to ask this, can you give me an email/link to Google Developers help/support? thanks.
For apps that run on the Android Wear Device:
No, the list of system-provided voice actions is fixed (and listed here). You can set your application to be able to respond to them (for example, to take a note), but you cannot add new ones.
Yes. When already inside your app, you you can use startActivityForResult() using the ACTION_RECOGNIZE_SPEECH to get voice input. You could then use the returned string to execute whatever you want.
Meanwhile, if you're just displaying notifications from an Android app running in a handheld, then you cannot presently have voice actions at all (at least in a literal sense). What you may have, though, is a notification action that requests voice input. That input will then be passed as an extra in the Intent that is delivered to the app in the handheld.

Android phone as a dedicated device

We want to use Android mobile for dedicated application. Can somebody suggest how can we make it happen.
Here are the requirement:
The phone when started, should launch our application., so the user cannot launch any other application. The application will be a 1D barcode reader.
The application should be live as long as the phone is up and running, user cannot close the application at all.
Thanks for your help.
Regards,
Manish
Android after boot is complete sends a bradcast intent:
android.intent.action.BOOT_COMPLETED
if you listen for this intent, you can launch a service that in turn launch your activity.
In the Activity you have to take care of the user's interactions that explicitly close the activity, like home button, back button and camera button press.
Setting your activity to be full-screen also should prevent the user to use the notification bar to interact with notification like those from market-app that can close your activity.
Finally, your activity can be killed by the system by various and uncatchable reasons: in those cases, the service that first launched your Activity comes in handy, as it can periodically monitor the general state of the application and relaunch components as needed.
Check out the new Android Enterprise solutions for your use case.
https://developers.google.com/android/work/overview
Its well documented. You can either use
Android Management API to provision the devices and apply policies to the device which will be applied to the device using Android's Device Policy Controller (DPC) or,
Use Google Play EMM API and develop your custom DPC
It depends upon your use-case really, but the first solution set should serve your purpose
I'm afraid there's no single answer to this, but you need to work on multiple fronts.
One of these fronts is preventing user from running other applications: for this there are applications sold on Android Market that can put other apps of your choosing behind passcode.
You need to combine this with automatic launch, but I don't yet know how to do that.

How to detect launch of an app in Android from a background service or another app

I want to create an app or background service that just listens for the launch of a 'default' app, say Contacts or the built-in Gmail app. If the contact app is clicked, I want to transfer control to my app temporarily (e.g. present a Yes/No popup to the user or increment an internal counter of my app ) and then redirect the user back to the app that was clicked. I want to do this only for a couple of 'well-known' built-in default apps, not any third party apps.
Is this possible? May be using some special intents?
Have you tried registering broadcast receivers for the intents that would launch those built-in apps? This might not work since that might confuse Android into thinking your app is a potential target for those intents (e.g. that it should be used to actually write and send the email in the case of a 'compose an email' intent), but it should be a good place to start.

Categories

Resources