Requirements Description:
Add a link to our game, open it directly in the browser, go to the corresponding website, and make some payment activities.
Solve:
So I went to Baidu a bit, found this article, http://blog.csdn.net/teng_ontheway/article/details/9614125. A preliminary glance, the steps are cumbersome, you need to modify C + + code. According to this method, at least the PC can be out of effect.
Later, we found that our leadership solved in a simpler way, using Luajavabridge directly, eliminating the hassle of modifying C + + code, and reducing the workload by N times. Master is the master, the mind is not limited.
1 increased calls in Lua
functionopenbrowser (URL)ifIsadroid () = =true Then LocalJavamethodname ="Openbrowser" LocalJavaparams ={URL}LocalJavamethodsig ="(ljava/lang/string;) V" LocalOK, ret =Luaj.callstaticmethod (Package_name, Javamethodname, Javaparams, Javamethodsig)ifOk Then return 1 Else return-1 End End return-1End
2 adding implementations in Java
Public Static void openbrowser (String url) { if (textutils.isempty (URL)) { return; } = uri.parse (URL); Intent new Intent (Intent.action_view, URI); S_instance.startactivity (intent); }
Just 2 steps is that simple.
Self-reflection AH reflection ah.
Quick opens the URL with the system browser