Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Let Corona Native become more easy
Started by www.sayhong.net Sep 12 2017 05:33 PM

No replies to this topic
corona native corona enterprise
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

www.sayhong.net

[GLOBAL: userInfoPane.html]
www.sayhong.net
  • Enthusiast

  • 61 posts
  • Corona SDK

Dear Corona sdk team:

I use Corona enterprise over 3 years, and feel happy with this product.

I read "https://docs.coronalabs.com/native/" today, there are too many steps to setup a project.

Can it be more easy?

 

example:

1.Copy project folder (include Corona/Android/iOS) to project folder.

2.iOS : open .xcodeproj

3.Android : import android folder to androidStudio

 

build in functions:

in main.lua

_G.callNative = function(str)
   pass value 'str' to Native code
end
_G.callLua = function(str)
   get value 'str' from Native code
end

in native (AppCoronaDelegate.mm/CoronaApplication.java)

handle callNative and callLua with Lua code

 

Then we can use 'if then else' to do everything we want.

example:

 

in Lua side:

_G.callLua = function(str)
   local arr = str:split(',')
   local functionName = arr[1]
   if functionName == 'showAds' then
      local adType = arr[2]
      local speed = arr[3]
      if adType=='admob' then
          do show admob ads
      elseif adType=='facebook' then
          do show facebook ads
      end
   elseif functionName =='getGPS' then
      local loc,lat = getGPS()
      //async callback
      _G.callNative('showMap,'.. loc..','..lat)  
   end
end

in Android side:

CallLua("showAds,admob");

in iOS side:

[self callLua:@"showAds,admob"]; 

Users can decision what data format by himself (json,xml...etc).

 

more easy more Corona sdk user.

There are too many steps to build a function bridge with tradition way.

 

Or another way to make this be easily.

Thank you ~




[topic_controls]
[/topic_controls]