How to handle Email on Google TV - google-tv

My HoneyComb application runs on tablets and Google TV. I have setting to send email in my settings fragment, but it returns error of "No app can handle this function."
Is there a way to send email to browser through my application if there is no client (createChooser) available?
I also tried to display a summary of the customer service email, but summary is not working on HoneyComb. I was trying this so I could have disabled Intent on tv.

Is there a way to send email to browser through my application if there is no client (createChooser) available?
Not unless you know the specific email Web app and all of its details, and that email Web app supports some sort of direct-email-sending capability.
Either prompt the user to install an email app, or send the email yourself (e.g., JavaMail), or do not use email for communications on Google TV. I would expect few Google TV users to be using email on their televisions, so you need to plan accordingly.

Google TV includes a default, stub email app, so the system will appear to have an email app installed, even when there is none. There's a special check necessary to detect the stub:
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("plain/text"); // special mime legacy for gmail; others work
List<ResolveInfo> match = getPackageManager().queryIntentActivities(emailIntent, 0);
boolean hasEmailer = match.size() > 0;
Log.w("thuuz", "has plain/text Emailer: " + hasEmailer);
if (match.size() == 1) {
ResolveInfo info = match.get(0);
boolean real = true;
if (info.activityInfo.packageName.startsWith("com.google.android.tv.frameworkpackagestubs"))
real = false;
Log.w("thuuz", "has *real* Emailer: " + real);
}

Related

I am using NSSharingService in my macOS Swift app. Is there any way to make sure the default mail client is configured with a valid account?

I am using NSSharingService to prepare an email with attachment for the user of my macOS app. My code is:
let emailService = NSSharingService.init(named: NSSharingService.Name.composeEmail)
if emailService.canPerform(withItems: [emailBody, zipFileURL]) {
// email can be sent
DispatchQueue.main.async {
emailService.perform(withItems: [emailBody, zipFileURL])
}
} else {
// email cannot be sent
// Show alert with email address and instructions
self.showErrorAlert(with: 2803)
}
This works correctly, but if the code is executed on a fresh system, Apple Mail will be opened asking the user to configure an email account. Some users may not understand what is going on in this situation. Is there a way to ascertain if the default Email Client is configured, so that I can inform the user if it is not ? Thanks for your help.

Google Assistant: Open / continue action on phone

I'm developing an action for Google Assistant and I was wondering if I could continue an action which I have started on a device without a screen (e.g. Google Home) on my mobile phone.
E.g. I ask Google Home to search for a good hotel in New York and when it tells me the result I maybe want to visit the corresponding website on my phone. Another example would be: I'm ordering pizza and for the payment process I would have to authenticate via fingerprint / password on my mobile.
Does anybody know if that is / will be possible?
Yes, I guess it is possible. It depends on how better you write the webhook for the application.
For this example:
When you ask Google Home to search for a good hotel in New York, keep in mind to make a follow-up intent if the user is asking to check for more details of that hotel, like phone number, or email or other contact details.
In webhook, make an action for this follow-up intent which is to be triggered.
And in the response, call the getHotelDetail() function, which would be a user defined function.
Here is a demo code to understand:
def getHotelDetail(hotel):
# get all the hotel details using an API or JSON
# return hotel-details
def processRequest(req):
# if req.get("result").get("action") == "follow-up-hotel-details":
# data = getHotelDetail()
# else:
# return {}
# res = makeWebhookResult(data)
# return res
def makeWebhookResult(data):
# return whatever you want to display/speak as per the
# processRequest(req)

How can I get email id of the google user while using playgameservices sdk in Unity 3D?

I am using playgameservices sdk for unity in my game. However, I am not able to get the email id of logged in user on iOS. Do I need to define any permission while initialising the playgamesserviceplatform class? Please let me know the correct procedure to get email id.
Thanks
I found this link that might be helpful. Below is the process described in the link
In order to access the player's email or access token, you need to configure a web app associated with your game in the Play Game Console. If your game does not use a custom back-end application, you can set the launch URL to be https://localhost.
Copy the client id from the web application and enter it in the setup dialog for this plugin. This will configure the correct permissions and settings needed to access the email address and access token.
To get the email:
Debug.Log("Local user's email is " +
((PlayGamesLocalUser)Social.localUser).Email);
To get the access token:
Debug.Log("AccessToken is " +
((PlayGamesLocalUser)Social.localUser).accessToken);
To get the id token:
Debug.Log("IdToken is " +
((PlayGamesLocalUser)Social.localUser).idToken);
NOTE: The email and access tokens are only available on the UI Thread. If you need to get these from the non-UI thread, you can use the helper function RunOnGameThread:
GooglePlayGames.OurUtils.PlayGamesHelperObject.RunOnGameThread(
() => { Debug.Log("Local user's email is " +
((PlayGamesLocalUser)Social.localUser).Email);
// use the email as needed
});

Opening mailto: links from webview

Just want to start off by saying I'm not a much of a Java dev or anything of an Android dev. The links I've found on SO for solving my issue aren't specific to WL, and I'm not sure where to place the 'solutions' in the build.
I've got simple email link to start this:
In Android (4.0.4) the app will crash saying it's not a supported protocol. That much is expected.
One of the solutions I have (below, from SO, lost the link) seems like the right way to go, but I'm not sure where this is supposed to go.
#Override
public boolean shouldOverrideUrlLoading(WebViewClient view, String url) {
if( url.startsWith("http:") || url.startsWith("https:") ) {
return false;
}
// Otherwise allow the OS to handle it
else if (url.startsWith("tel:")) {
Intent tel = new Intent(Intent.ACTION_DIAL, Uri.parse(url));
startActivity(tel);
return true;
}
else if (url.startsWith("mailto:")) {
String body = "Enter your Question, Enquiry or Feedback below:\n\n";
Intent mail = new Intent(Intent.ACTION_SEND);
mail.setType("application/octet-stream");
mail.putExtra(Intent.EXTRA_EMAIL, new String[]{"email address"});
mail.putExtra(Intent.EXTRA_SUBJECT, "Subject");
mail.putExtra(Intent.EXTRA_TEXT, body);
startActivity(mail);
return true;
}
return true;
}
Any help is obviously greatly appreciated!
In a Worklight hybrid application, you are not required to use native code in order to use features such as mailto:.
To get it working, i.e: to click a link that will open the email screen for the user to fill in the subject and message, you can follow the below. If you need greater functionality, elaborate on it in your question:
Make sure you are using the latest iFix available for the version of Worklight that you are using (due to recently fixed Cordova security bugs that affect this functionality). This can be obtained from either the Eclipse Marketplace or IBM Fix Central.
Follow these steps:
In native\res\xml\config.xml, remove and add the following lines:
- <access origin="*"/>
+ <access origin="mailto://*" launch-external="true" />
In common\index.html I then tried with:
Send email
The result was (depending on your phone setup): either to get an option to set up an email account, select from which account to send the mail to, or get the email compose screen.

How to start the mail app from titanium

How do you start the Mail app from a Titanium app?
I am looking for the equivalent of an HTML mailto: link where I can specify the email and maybe the subject from with in a windowView.
I am not using a webView.
Will
Try this one:
var emailDialog = Titanium.UI.createEmailDialog();
emailDialog.subject = "Sending email from Titanium";
emailDialog.toRecipients = ['name#gmail.com'];
emailDialog.messageBody = 'Appcelerator Titanium - Testing sending email';
emailDialog.open();
But remember that you cannot test this send email feature from iPhone Simulator (because iPhone simulator lacks of setting email account). Try to check in real phone.