Hi!
I am fairly new to this and I am on my way to making my first mobile game!
I am just wondering if there is a simple way to let the user/player email directly to me at an email that I set.
So, in my mind, the user would touch a button on the main menu and it would open up the mailing app or something like that.
This way, it’ll simplify the bugreporting and suggestions.
Sample code in JS or resource links would be greatly helpful!!
Best regards, and thank you for any help you provide.
I have this piece of code in the main activity in the android project:
public static void EXT_shareText(String textToShare) {
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, textToShare);
sendIntent.setType(“text/plain”);
Cocos2dxActivity.getContext().startActivity(sendIntent);
}
Use sendintent.setType("message/rfc822"); instead. It will display only e-mail applications.
Also add sendIntent.addEmailTo("youremailid@gmail.com"); sendIntent.setSubject(activity.getString(R.string.app_name));
@fubit Or you could simply use the good old mailto with parameters. It would open the os default mail application and the user will send you the mail as usual. Sometimes best solutions are simple solutions.
You can specify the subject and even the body of the email:
Thank you! this seems like exactly what I need!
However, how would I go about implementing into the game? (I’m not sure as I am quite new to this and app/game development in general.)
As well, is there something similar to this on the Android and Windows platform? Or is it all universal?
The game will be hosted hopefully on iOS, Android and Windows, and I am not sure how to place in the JS mailto functionality without HTML. As far as I understand, Cocos2d JS requires no html for hosting on phone.
Hi, I’ve been reading the suggestions posted on this thread and have tried getting the mail functionality to work myself. Does the xCode iOS simulator have the capability to open a mail application?
I was using:
window.location = ‘mailto:example@gmail.com’;
to try and get the simulator to open a mail application, but nothing happened.
@fubit, @calicorob Sorry for delay. But i’ve figured out, why it won’t work like that.
It seems that this call will only work from UIWebView on iOS devices:
Without UIWebView (as in case of Cocos2D-X), you will need some kind of mixin from Objective C or C++ after checking if (cc.sys.isNative):