Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 3rd Jun 2013 20:06
i was just wondering how i would go about creating a form which allows text to be inserted and sent to say an email address..?

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 3rd Jun 2013 20:46
Well, create some prompts and a bunch of EditText objects and a submit button.

Then, gather all the data.

However, sending the email is a different issue. There are no AppGameKit functions for that.

But, if you have a website then you can probably pass all your data to a file on the server and have it send the email. I do this from a lot of web sites from within Javascript (using AJAX). It wouldn't be too different if you have the correct mail stuff set up on your site.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Jun 2013 23:34
at pc this works, its opens the default mailer.
(need url encode)

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jun 2013 00:13
I forgot about the 'browser' wrinkle. It is a viable way and puts the onus of the mailer on the user.

However, not everyone will have email set up on their devices. For instance, I don't have email set up on any of my iOS or Android devices.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 4th Jun 2013 00:29
The email was an example but if there's a more efficient way id love to know

kirtnicholls
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 4th Jun 2013 00:47 Edited at: 4th Jun 2013 00:47
the question is, what you will do with the text?
transfer forwhy and whereto?
with the multiplayer network commands you can send bytes from app to app
also over the internet around the world.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jun 2013 04:35
I don't have a more efficient way that has been used in AGK.

I only know how I do it on my sites. But the principle is the same.

The first trick is that you have to have a server that you can create an email address for the sender and the appropriate script files for handling the passed input. The ones I use are all done in PHP (including the SMTP class).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 6th Jun 2013 20:13
Would this work


i will be using variables for the subject and body

kirtnicholls
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 6th Jun 2013 20:33
yes but you must encode this variables because special chars.
http://en.wikipedia.org/wiki/URL-Encoding

subject$=""
body$=""
openbrowser("mailto:someone@yahoo.de?subject="+subject$+"&body="+body$)
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 6th Jun 2013 21:10
kirtn14, that will probably work as long as the user has an email app set up on their device and has an active internet connection.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 7th Jun 2013 23:53
how would i print the text to the screen so the user can view the text they have inserted?, ive tried using the variable the text is stored in to create a text string but it wont work. as well as making the text i would like it to store the text when it goes over the screen and move it to a new line (paragraph the text)

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 7th Jun 2013 23:59
You can can create a TextObject, set the size of the font and the size of the object and then tell it the maximum characters (in that order) and then add the text to it and it will wrap the text in the display.

If the text put into the TextObject has carriage returns ("\n"), then it will insert line breaks. You need two to create a spacer line.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 10th Jun 2013 22:13
could you please tell me the code used please? i couldnt find anything about text objects in the documentation

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 10th Jun 2013 22:37
This help page deals exclusively with the Text object (my mistake in making it one word).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 19th Jun 2013 23:25
Ive made it work now, thankyou, but the data does not send it just closes the application

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Jun 2013 23:35
If you show us what you are trying to do (code wise) we might be able to help.

I wouldn't be surprised if it is necessary to have an active mail application with a default email address on the device before this will work.

And you cannot assume that that is always the case. I don't have email set up on any of my tablet devices.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 20th Jun 2013 18:26
ok



kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Jun 2013 21:40
I don't know what is the purpose of all the SetTextCharPosition calls after checking the position of the 31st character? The Text object is perfectly capable of aligning itself. I am also surprised that it is working with a blank input. Since the SetTextCharPosition is sort of assuming that the string associated with the Text object has the right number of characters so that the passed index points to something.

But, because you keep recreating your text object at the top of the do loop, you destroy the ones that were created before and perpetually reset. And this will lead to a serious memory leak. Plus, all your work to position all the text gets wiped out and redone the next loop, because you create a new Text object.

You only need to create one instance of the Text object (outside of the do loop) and you can update the text any time. If you give it a maximum width (call SetTextMaxWidth after all other commands that set the text size and font and such), it will automatically wrap text. You then use the SetTextString command using text$ as the input AFTER you collect the text using GetTextInput. Then, it will stay displayed until/unless you get another string by clicking on sprite[2].


Additionally, in your openbrowser call, you didn't pay attention to the post talking about encoding the inputs. The text as you have it for the subject would cause major issues if the browser even tried.

You also appear to think that pointer may experience multiple states/conditions within the same synch loop. And we've had this discussion before. Unless you call Sync() multiple times, the pointer is checked only once each loop and will NOT change until the next call to Sync().

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 21st Jun 2013 21:02
is this any better?



the email still wont send though

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Jun 2013 21:23
It looks much better.

But, you still haven't encoded the subject$ and body$ strings.

Also, do you have email set up on the device you are testing on?

I just did a very simple test on my PC, just one line using openbrowser and mailto and two things happened:
1. a browser opened up with the line I used
2. the mail composition dialog for Outlook opened up with all the fields filled in

When I ran it through a Player, the mail composition form for Gmail opened up with all the information filled in.

This is the code I tested (with a different email address):


Now, the subject in the mail form appeared as 'test test' and the the body had 'this is a test'.

I substituted '%20' for each space. %20 being the hex representation of the decimal value 32 which is the ascii value for space. That is a very simple encoding.

The v10813 version has the following command: HTTPEncode.

You can very safely replace this:
openbrowser("mailto:novaappz@gmail.com?subject="+subject$+"&body="+body$)

with this:
openbrowser("mailto:novaappz@gmail.com?subject="+HTTPEncode(subject$)+"&body="+HTTPEncode(body$))

And, assuming the rest of your code works, this should open up your email app with the filled in form.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 21st Jun 2013 22:47
this


works on my laptop, opens the browser and the default messanger program... but when compiled and run on an android device the app just closes even though i have an active gmail account set up

kirtnicholls
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 21st Jun 2013 22:57
at android your app should goto background
and the default mail app should appear,true?
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Jun 2013 23:14
Yes, that is what happens.

Does it work if you broadcast to the Player on your device?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 21st Jun 2013 23:24
It should do but the default mail application is not opened, im working on getting the broadcast to work. I havnt managed to get it to work so far :L

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Jun 2013 00:15
If you can't get it to work in the Player, don't bother going through the exercise of building an APK.

Unless, that is, you want to use Eclipse to watch the LogCat to see if it shows you any errors.

Are you sure that you are using the same version AppGameKit IDE as your Player?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 22nd Jun 2013 12:52
the broadcast runs but no touch functions work so nothing could be done

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 22nd Jun 2013 18:22
No touch functions worked?

This is odd.

I reworked your code a bit to optimize some things and make sure that only one thing is being processed per Sync() call.

I also used GetSpriteHitTest instead of GetSpriteHit to be more specific. This is a better option because you know that you are only checking three sprites and it keeps the command from cycling through all the sprites to collect the hit list.

Try this and see if it works better:


Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 23rd Jun 2013 15:17
Ive tried the scrip, it works on pc but not android the app just closed and nothing happens

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd Jun 2013 18:50
What is the version of your Android Player? When did you last download it from the Play Store (or did you build your own)?

What is the version of your AppGameKit IDE?

What version of Android is your device?

Does the Player start properly on your device? (Shows agk icon and 'STANDBY')

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 23rd Jun 2013 19:28 Edited at: 23rd Jun 2013 19:30
.

kirtnicholls
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 23rd Jun 2013 19:28
I did both, i compiled the application and used a version of agk player (downloaded 2 days ago)
I use both v10811 (broadcast wont work at all) and v10814 (broadcast works but cant use the app on the device)
Tier 1
Android 2.3.5
Also tried it on a kindle wildfire
and yes it does

Neither broadcast or compiling the app makes it work

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 23rd Jun 2013 23:00
Okay, I just ran my test code (using your email address) via a v10813 Player, broadcast from v10814 IDE, on my Philips GoGear Connect (Android 2.3.3):


Since the device had not had a google account set up, it took me to the setup page.

Then, after setting up the google account and restarting it all, the test worked fine.

Try running the code above (in this post) and see if it works on your PC from the IDE and then broadcast to the Player.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 24th Jun 2013 21:03
thanks
))

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Jun 2013 21:49
No sweat. I hope you get it working.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 24th Jun 2013 21:53
It works until I compile it

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Jun 2013 22:45
I take it that you mean running the 'compiled' <yourapp>.exe crashes.

The .exe produced by the AppGameKit IDE is basically just a renamed copy of <winagkpath>/IDE/Compiler/interpreters/Windows.exe.

You can see if it is that file that Windows 8 doesn't like by creating a media directory in <winagkpath>/IDE/Compiler/interpreters, copy your byte code file there and rename it Windows.byc. Then you can run Windows.exe and it will show you whether the issue is the built interpreter or the AppGameKit IDE interpreting.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 24th Jun 2013 23:15
Sorry I mean when image the APK file, the finished app does not work

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 24th Jun 2013 23:47
This is about the point that I would actually have to sit in front of your computer to make sure your Android setup is correct and using all the correct file versions.

And then look at a variety of files (the ones and order to be figured out while looking at the file directories).

So, it is working when broadcast but not when you build the apk.

Are you remembering to refresh the project in Eclipse before you run it?

Does your Eclipse see your Android device?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 24th Jun 2013 23:56
Yes, is something supposed to happen when I refresh it...
I use an emulator then copy the APK from the bin folder onto the device

kirtnicholls
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 24th Jun 2013 23:59
Do you actually install it, using the app manager?

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jun 2013 00:10
The emulator pretty much doesn't work.

If Eclipse doesn't see your device to install it, simply 'cancel' when the 'Android AVD Error' popup talking about 'No Compatible Targets'. The necessary apk generation has already completed by then.

When I copy an apk file from my PC to an attached device (that Eclipse doesn't see), I copy it into the devices Download directory. Then I use a file manager on my device to navigate to that directory, tap on the apk file and install it.

You aren't by any chance creating an apk file that has spaces in the name? That can be a problem for some (most? all?) Android devices.

If your device didn't come with a file manager already, there is a free one named 'File Manager' in the Play Store. I suggest the one by Rhythm Software.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 25th Jun 2013 09:33
Yeah

kirtnicholls
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 25th Jun 2013 09:34
Yeah I do i

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jun 2013 16:47
If your apk has spaces in the file name, fix it and see if that clears up the issue.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 25th Jun 2013 23:17
Yes

kirtnicholls
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 25th Jun 2013 23:18
Yes I do install it

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 25th Jun 2013 23:43
Your posts are becoming way too cryptic. 'Yes' to what? (spaces in apk name?) Ditto on next short response.

Does this mean you have it fixed?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 9th Jul 2013 19:21
yes, sorry I thought I replied to this message but it may not have gone through

kirtnicholls
kirtn14
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location:
Posted: 9th Jul 2013 19:22
I in stall the application as if it has come from the app store, but it does not work even though it works through agk

kirtnicholls
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 9th Jul 2013 20:05
Did you fix your project so that the apk file doesn't have any spaces in the name?

And are there any files in your media that have spaces in the names (or subdirectories with spaces in the name)?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-11-24 20:36:29
Your offset time is: 2024-11-24 20:36:29