I have a question.
I have to make link/button in html which will contain number. If user clicked on this button/link he should be redirected to panel/views where we type the phone number.
Do you know how to do this?
You need to have a Protocol Handler. Lets say something like
Pawel:// or any other. The URL should be triggered when you click the Button on
the web page in the mobile device.
In the AndroidManifest of your app you have to register this
protocol handler. This tells android that your app is capable of
handling that protocol handler. If your is the only app installed
at the user that can handle this protocol handler, then clicking
of the button will open the app(your desired activity)
automatically. Otherwise it will ask user to choose amongst the
available option.
Along with this custom protocol handler, you can attach a parameter
containing the number. This parameter can be parsed in the app(inside onCreate, when
it receives this url in the activity with the intent.
After parsing you can set it in TextView.
You might want to check Android / iOS - Custom URI / Protocol Handling if still working on it.
Related
I made a small Google Home App and my service returns a response with a SimpleMessage + Card.
It works perfectly when running the app in the console.actions.google.com simulator. I get the card all good.
But when I test talking to the Google Home, it only sends the text, no trace of the Cards anywhere.
However If i talk to the Google home app on my phone, it does send the card correctly.
Is there something to enable to be able to receive cards sent by Google Home? Is it possible at all?
There is no way to make cards that were sent while the user is talking via Google Home visible, but there are several techniques that you, as a developer, can use if cards are necessary.
First of all - good design suggests that cards should be use to supplement the conversation, not be the focus of the conversation. Make sure the voice conversation itself is important and use the visual elements only when necessary. If your action is overly visual - it may be better suited as a mobile or web app, rather than an Action.
If your device requires a screen, then you can set this in the Action Console when you configure your question. This will, however, prevent it from being used on a Google Home device.
If you don't want to go this route, and want to allow it to be used on a smart speaker, but still take advantage of a screen where it is available, you have a few options.
First is that you can just send the cards. As you've discovered, they won't show up, but they won't cause any problems.
If you want to act slightly differently if a screen is available, you can check for the surface capabilities that the user's Assistant is capable of at that moment. If you're using the node.js library, you can have a command such as
let hasScreen = app.hasSurfaceCapability(app.SurfaceCapabilities.SCREEN_OUTPUT)
to determine if a screen is available and take action based on the variable hasScreen. If you're using JSON, you need to check the array at surface.capabilities or data.google.surface.capabilities to see if "actions.capability.SCREEN_OUTPUT" is one of the available surfaces.
If not, and you get to a point in the conversation where you feel you need to send a visual result, you can also request to continue the conversation on a device that does support screen output.
First, you'll need to make sure that they have a screen available. You'll do this with the node.js library with something like
const screenAvailable = app.hasAvailableSurfaceCapabilities(app.SurfaceCapabilities.SCREEN_OUTPUT);
or by checking the availableSurfaces.capabilities or data.google.availableSurfaces.capabilities parameters in JSON.
If one is available, you can request to continue the conversation there with something like
app.askForNewSurface(context, notif, [app.SurfaceCapabilities.SCREEN_OUTPUT]);
where context is the message that will be said on the Google Home, and notif is the notification that will appear on their mobile device (for example) to let them continue the conversation. If using JSON, you'll need to use a actions.intent.NEW_SURFACE next intent.
Either way, the user will get a notification on their mobile device. Selecting the notification will start up the Assistant on that device and your Action will be called again with parameters that let you check if they are on the new surface. If so - you can send the card.
I'm trying to get an idea of what's possible and what isn't in terms of using a custom dialler app for internet calls.
The idea is that the standard Android dialler be used when no internet connection is available, but use a custom-written VOIP dialler / caller app whenever an internet connection is available.
I see that in the Android call settings you can set it to use Internet calling whenever a connection is available. How does this work? Does this simply tell the native dialler app to use internet calling, or is there actually a specific Intent or something that gets fired when an internet call is made so that I can open my custom SIP app?
And also, is the 'standard phone app' icon always linked to the standard phone app, or can you override this phone icon to open your custom VOIP app when a connection is present?
So basically, is there a way to seamlessly and automatically switch between the standard dialler and the custom SIP dialler based on whether or not the phone is connected to the internet?
If not, is this something that could be done by customizing Android?
Thanks,
There are four possible ways of doing what you want that I know of:
1. Replace the Android Dialer
This is hard and a lot of work. The Android Dialer (last time I checked anyway) WAS the telephony stack in Android. So to replace it you have to replace the complete telephony stack (including any public API) i.e. handle all cellular (and now sip) calls in and out of the device. Also the only way to replace it is to root the device as it can't be replaced normally.
2. Provide your own Dialer that is separate to the main dialer.
This has it's advantages that you will never get into "trouble" with anything else.
3. Hook into the outbound call API (ACTION_NEW_OUTGOING_CALL)
This is something that is pretty cool and I haven't seen any other OS allow you to do. Basically you can trap when either the normal dialer starts to dial a number (or when another application starts to dial a number as well) and you can either allow it through, modify it or cancel it. Behavior I've seen from sip clients is that they will cancel the call and put up a selection screen prompting where you want to send the call (sip, cellular or something else).
Here is an example of it's use.
The downsides are:
You can be fighting with other applications to which gets first go. There is a 'priority' setup, but all I've seen is everybody wants to be number one.
On some Android devices where the OEM providers that own Dialer, they don't always fire it!!!
4. Detect when the dialer is shown and show your own dialer in front of it.
This works and does allow you to provide a nicer more integrated feel as you can provide call type selection within the dialer, as well as other custom number lookups but that can be a little tricky to do on some devices.
I would suggest 3 to begin with as it's pretty easy to do and you can get something up going pretty fast. In code that I have worked on, we have done 2, 3 and 4 and also looked into 1.
I want to make an android service that would let me simulate keypress to fill fields on a web page when receiving an intent. Is this possible in any way or maybe through a different process (Not by simulation keypress?).
For example an example of what I would want to be able to do.
The user is on his tablet and has selected a field on a web page. For any bluetooth device discovered, fill the field with that id.
IS there a way to do it by calling an intent of the web browser or something like that?
Thanks
EDIT : figured my example was pretty bad.
Here is what I really want to do
When a nfc tag is detected on the phone,
read the nfc tag ID,
simulate keypress events of the id tag on whatever the focus is at the moment on the phone
Example : I'm on google focused on the search field and I put a nfc tag on the phone, the phone types the Nfc tag id on the google search field and voila
if you really want to simulate keyevents, you can use system calls:
input keyevent <keycode>
I would advice you to use BroadCast receiver. You have to create a Custom intent class after that, register the receiver when the user select a field. For interaction with web page, its better to use javascript to call native android method.
When you detect a device send your broadcast, if you are registered, you will handle the event.
I am developing an android application. What i want is to call a method present in that android application remotely from a desktop like from a "servlet" or an application.
How can this be done?? For example i want to call a method which i have already written in the app which calls a particular number. How can i invoke this method remotely?? please help.
PS - It is kind of urgent.
It will be hard to communicate from your desktop to your handheld. But you can poll a server from your handheld.
Write an app that every n seconds (the frequency you require) polls e.g. a web page on your server. When the web site's content is "noop", the app does nothing and keeps on polling. If the web site's content is "doit", the app dials the number you want.
So, when you change the content of this web page either manually or programmatically you can "remote-control" your hand held.
This is just an example, it must not be HTTP, neither NOOP and DOIT, just anything you like. Let the server return the phone number which you want dialled for instance.
Well, sounds like you want your app to be waiting for push notifications. I think this question is exactly what you need to look at.
is it possible to press a button and start a call e.x. in skype?(i know that is possible for a telephone call but i would like to see if i can make this stuff with a voip app as skype)
If the user has skype installed, and the user tries to place a call there are two options you can take:
i.e. just try and call skype directly (but this requires knowing the correct intent to launch skype) or you request to make a call and the user will be shown the option to use skype to place the call (unless they've set the default dialer and the primary application).
I think there may be a way to get a list of activities that are registered to handle certain events (i.e. get the list of dialler apps on the device) from this you might be able to find the skype app and get enough information to force the use of that. The problem with this is you are then tied into using skype and only skype rather than let the platform handle it.