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.

AppGameKit Classic Chat / Opening app from URL and doing an action based on parameters on the URL

Author
Message
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 22nd Oct 2017 13:20
Is it possible to open an AppGameKit app from a URL and have the AppGameKit app do something based on what parameters are on the URL? I know there's a thing called intent and I saw someone ask for intents to be added back in 2016 but kind of reverse i.e. the AppGameKit app would share to another app and in that thread TGC said they'd see if they could add it to the next version (that was 2016)

I don't want to share from an AppGameKit app to another I just want to be able to share a URL that once clicked will open the AppGameKit app and do something.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 22nd Oct 2017 23:30 Edited at: 22nd Oct 2017 23:52
I may be wrong, but opening the app via a URL would be accessing an HTML5 version of the app, right?

Unless they have changed things in an update, HTML5 builds cannot network or access files.

I was thinking that calling a URL to a PHP script may work if the script wrote a file with the data then redirected to the URL of the HTML5 app.

But if files are a no no for HTML5 apps, then I have no ideas that would work.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 23rd Oct 2017 09:30 Edited at: 23rd Oct 2017 12:07
No not an HTML version. It would open an app on the device if it's installed. Netflix has it. When you click on a link in an email from them it opens the Netflix app. Quite a few apps have it. You have a file installed on your server that tells the browser to open the app if a certain URL is accessed and your app can deal with the URL and do something. Going back to the Netflix example if you press the "add to my list" button in the email it opens the Netflix app and adds the show or film they were promoting in their email to your watch list.

I can see potential for this with my app.

I think its possible to open the app from a URL now, although I've been having trouble. However I don't think AppGameKit has anything in place to deal with the URL that just opened the app and then do something with the parameters on the URL

EDIT: They are called intent filters: https://developer.android.com/training/app-links/deep-linking.html

I've had trouble setting up this to even open the app but I know if I ever did get it to work AppGameKit probably doesn't have anything in place to read the data on the URL and action something
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 23rd Oct 2017 15:55
@ Kevin
PM sent

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 23rd Oct 2017 19:55 Edited at: 23rd Oct 2017 20:08
Still don't know the correct channel for reporting bugs and requesting features so will just ask here for it to be considered as a feature to add in a future update.

I don't want it for this reason but lets say you create a game that lets users create levels and you want them to share the levels for others to load. You really only have two options that I'm aware of. You show a unique and randomly generated code that the user can share with ShareText (this code will be stored in an online database and links to all of the data and settings for the level created). The user that wants to load it has to manually type the code into an edit box as there's no ability to copy and paste in AppGameKit on the device. You'd want the codes long enough so that they're not easy enough to guess and stumble across but not too long that the user gets fed up with typing or they type it in incorrectly. Write it on paper first and then type it in (that's pretty much a rubbish option). The second option is you encode the id into a QR image and get the users to share that and they then load the image into the app to get the level data. This works, and as far as I'm aware is the best option in AppGameKit (but not really the best option in general)

The best option would be to share a URL with the level id appended to it (share with ShareText) and when the user clicks the link it opens the app, checks the id and if it's a valid id it loads the level data.

This is what the url/uri might look like: http://www.mytotesamazeballsgame.com/leveldata/asqaawwq2123dascxcawq43

That's my understanding of it all anyway.

I believe AppGameKit would needs some extra commands like GetIntentData() to load the data from the URL and then action it to load the level.

Of course another option is to just add copy and paste for edit boxes. I'm sure most users would be happy to copy a string that looks like this and asqaawwq2123dascxcawq43 and paste it into the app.

Is there another working option that I'm not aware of?

EDIT: I initially thought you needed a file that lived on your web server to get the first part of this to work but after reading some more documentation it's safe to say that I don't understand it at all.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 24th Oct 2017 01:32 Edited at: 24th Oct 2017 01:57
Quote: " The second option is you encode the id into a QR image and get the users to share that and they then load the image into the app to get the level data. This works, and as far as I'm aware is the best option in AppGameKit (but not really the best option in general)"

I am having fun with these QR codes.

These may not be the best way to go, but they certainly are fun to work with and snapping an image is a lot easier than typing anyway.

I think you are already on the right track for what you are trying to do, and I would wait and see if you get any complaints from users, because they might think these things are cool.

I hope your new command requested gets granted in a future update, but these will definitely be fun to work with in the meantime.

Here is one that I whipped up for my website. (I am digging them, and I am glad I happened upon your threads to get turned on to them)

I got the idea for this funky one from the fancy ones that some companies have, like Starbucks.

They use dots and add colors along with their logo, so I tried to go all out with this one that I made from scratch this evening.

I tried it in AppGameKit and it read it okay, but I have not tried to test it with a phone to see if it can read it and go to the website.



Here it is at 50% of the size and AppGameKit read this one fine too....


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Attachments

Login to view attachments
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 24th Oct 2017 09:55
Nice one! They do look colorful! Did you create these using an online web service or app? Or did you download some code to create them on your site?

I wanted an image in the middle of the AppGameKit QR codes but settled with text around the edges in the end. I wanted some identifiers in small text so I could easily find the appropriate rows in the database for the shared QR codes.

Haven't tried it but looking at your color examples those might be possible to do with Memblocks in AGK. I've played around with Memblocks once and managed to loop through each pixel in an image and turn the alpha channel of each pixel to on and off so you could do the same by changing the color of the pixels in certain areas.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 24th Oct 2017 17:45 Edited at: 24th Oct 2017 18:08
Quote: "Nice one! They do look colorful! Did you create these using an online web service or app? Or did you download some code to create them on your site?"

Thanks! (they work fine when loading the image directly, but taking a snapshot with the camera is problematic)

I made these myself using Paint.NET and AppGameKit !

First, I used AppGameKit to create the QR code for my web address.

Then, the rest was editing with the paint program by hand.

Here is what the original code produced by AppGameKit looked like....



I used a layer with semi transparency to create the dots, then cut the lines out of the layer under when I was done.

In this image you can get an idea of how the dots replaced the nice fat lines...



Quote: "I wanted an image in the middle of the AppGameKit QR codes but settled with text around the edges in the end. I wanted some identifiers in small text so I could easily find the appropriate rows in the database for the shared QR codes."

I cheated with a work around as usual in order to get the image in the middle...lol

I would tell you but I have plans for making an APP to do this for people, because the online services I found charge $50 to $80 or more to do it.

Working now on making an app in AppGameKit that will allow users to type in their web address (or message) and load their logo image and the app will do the rest.

Quote: "Haven't tried it but looking at your color examples those might be possible to do with Memblocks in AGK. I've played around with Memblocks once and managed to loop through each pixel in an image and turn the alpha channel of each pixel to on and off so you could do the same by changing the color of the pixels in certain areas."

Exactly!!

That is where I am now, getting into the memblocks and studying the formats for the QR codes. ( I nave never used the memblock commands before)

Converting the image by hand is easy enough for me to do, but it is a bit tedious making those dots one by one with a paint brush. lol

My problem with the one above is that a lot of the cameras on phones use JPGs for the images, so certain colors are dithered (like green section) and it is unreadable.

Even zooming didn't help, but when I changed the dots to a dark gray tone, then it read the dots fine.

That is why big corp.s like Starbucks use dark dots and limit the color. (see theirs attached)

I plan on having a converter in my app too, so that poor images that are unreadable codes can be read and reconstructed by examining the whole image pixel by pixel with the memblocks, and that would resolve issues like the ones I am having with certain colors and codes saved as JPGs.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Attachments

Login to view attachments
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 24th Oct 2017 18:07
Good luck with it. Hard to imagine anyone paying to generate a QR code though. Probably 100's of apps on the store that do it for free with some form of customisation.

It was easy for me to put a logo in the middle in AppGameKit I just didn't have the time to test it when scanning to see if it covers any important part of the QR code and if it works sometimes or all of the time. I was in a rush to get the ability for users to share settings so went with a plain one.
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 24th Oct 2017 18:15 Edited at: 25th Oct 2017 04:36
Quote: "Good luck with it. Hard to imagine anyone paying to generate a QR code though. Probably 100's of apps on the store that do it for free with some form of customisation."

All the QR code generator sites I have found either have online web pages or apps to generate your QR codes.

Those are free for the plain codes, but if you want a logo or customization done, then they want you to pay for that service or for a membership to unlock those features.


Quote: "It was easy for me to put a logo in the middle in AppGameKit I just didn't have the time to test it when scanning to see if it covers any important part of the QR code and if it works sometimes or all of the time. I was in a rush to get the ability for users to share settings so went with a plain one."
.
Yeah, it all depends on the data in the code as to what part can be omitted.

It was trial and error for me in testing the part being cut out until I could find the right spot than didn't affect the message data.

It wasn't hard though, but different size logos can be tricky to fit in the center, and sometimes have to be offset a little depending on the code data.


Edit
I am not trying to high-jack your thread or anything, so I guess I will need to start my own WIP for the QRCoder app that I am working on.

I modified the example in the manual and have the snap shot working well, but once it can be read in, then I encode it back to a new image.

That gives a much better display than the camera's picture, but it does away with any fancy dots colors or logos at the moment.

I also replaced the END button with a "Create", and now text can be entered to generate a QR code image that is saved in the Pictures folder.

At first I had trouble getting the SaveImage() to work right, but a quick search in the forums revealed the secret to make my Android play nice.

Now it saves in the Pictures folder on the SD card if one is installed, or in the Pictures folder on the Phone if no SD card is present.

I think I will save the the ability to edit, reconstruct, and customize the codes for a PC version only for obvious reasons.

All of this was really easy to do with the great commands that Paul has given us, and the memblocks will unleash the real power of AGK.


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2024-11-24 08:47:06
Your offset time is: 2024-11-24 08:47:06