Google Instant Apps Native Extension

#1

Google Instant Apps

This is Native Extension for the Defold Game Engine implement Google Play Instant API methods.

Here you can find instruction how to build instant app using Defold.

Setup

You can use the InstantApp extension in your own project by adding this project as a Defold library dependency. Open your game.project file and in the dependencies field under project add:

https://github.com/AGulev/instantapp/archive/master.zip

Or point to the ZIP file of a specific release.

API

If you are working on cross-platform application the best practice to check the existence of instantapp module, this module exists only in android bundle:

if instantapp then
  -- call instantapp methods
end

instantapp.is_instant_app() Original DOC

Returns true if this application is an instant app.

if instantapp.is_instant_app() then
  --do something specific for instant app
end

instantapp.show_install_prompt() Original DOC

Shows a dialog that allows the user to install the current instant app.

if instantapp.is_instant_app() then
  instantapp.show_install_prompt() -- if this is instant app then show install prompt
else
  -- regular app logic
end

Popup example:

2019-04-07 20 54 02

instantapp.get_cookie_max_size() Original DOC

Gets the maximum size in bytes of the cookie data an instant app can store on the device.

local cookie_size = instantapp.get_cookie_max_size() --number, for example 16384

instantapp.get_cookie() Original DOC

Gets the instant application cookie for this app. Non instant apps and apps that were instant but were upgraded to normal apps can still access this API.

local cookie_byte_array = instantapp.get_cookie()

instantapp.set_cookie() Original DOC

Sets the instant application cookie for the calling app. Non instant apps and apps that were instant but were upgraded to normal apps can still access this API.

instantapp.set_cookie(bytes)

Issues and suggestions

If you have any issues, questions or suggestions please create an issue or contact me: me@agulev.com

10 Likes

Instruction: Android Instant App creation
#2

I implemented the most important two methods for a first version of the NE, if you need something else just give me know.

5 Likes

#3

whoah! This feature was ofter requested all around.

Can you please link to a game or a demo on the Play Store that utilises this NE already?

4 Likes

#4

Unfortunately, for now, I have only a dirty demo in test mode, but I’ll try to do an example later on this week. Also, I wanna add new functions for this NE.

3 Likes

#5

Epic!!

2 Likes

#6

Interesting fact: players who launched the Google Instant App on a page on Google Play account for approximately 10-20% of the number of players who installed the game.
In my opinion, this is a pretty good result, considering that we are talking only about organic traffic (from advertising you can launch the Instant app via a direct link).

I didn’t bother much and just using the Instant App extension I check if the game is an instant application, if yes, instead of restarting at the end of the level, I suggest installing the full game (almost the same apk, but on a permanent basis). Even with this approach, the game fits into a 4Mb limit for applications (for games, a 10Mb limit).

8 Likes

#7

I’ve released version 1.0.0.
Added new methods:
instantapp.get_cookie_max_size()
instantapp.get_cookie()
instantapp.set_cookie()

Those methods provide a possibility to communicate between instant application and the main application.

3 Likes