[Android-development] Build an Android Launcher in Qt ...

David Marceau uticdmarceau2007 at yahoo.ca
Sat Mar 1 00:37:30 CET 2014


On 02/28/2014 06:18 PM, David Marceau wrote:
> 
> Ok, firstly you need to know how to launch other applications in android:
> http://stackoverflow.com/questions/3872063/android-launch-an-application-from-another-application
> 
> Now you have to take the recipe you find most fitting and translate it
> into a cpp function call.  the QAndroidJniObject is definitely the right
> class to use for you to get there.
> http://qt-project.org/doc/qt-5/qandroidjniobject.html#QAndroidJniObject
> 
> Your app1 is the one that will have to create a jnienvironment:
> QAndroidJniEnvironment env;
> 
> //The Java code looks like this:
> //you do know the android mainactivity entry point
> //packagename >>>"com.my.app.name_two"
> //MainActivity name >>> "org.qtproject.qt5.android.bindings.QtActivity"
> //Intent intent = new Intent(Intent.ACTION_MAIN);

QAndroidJniObject app2Intent = NULL;

class name full path: android.content.Intent
necessary string constant name full path: android.content.Intent.ACTION_MAIN

Intent Constructor declaration:
Intent(String action)

> //intent.setComponent(new
> //ComponentName("com.my.app.name_two","org.qtproject.qt5.android.bindings.QtActivity"));

setComponent declaration:
public Intent setComponent (ComponentName component)

> //startActivity(intent);

You can see where I am going with this.
The end result is something like:
https://github.com/omac777/qtsnowloadcount/blob/master/trucktypetotalspage.cpp#L59


> 
> I extracted that information from your app2 AndroidManifest.xml
> 
> Cheers,
> David Marceau
> http://adequatech.ca
> 
> 
> On 02/28/2014 05:34 PM, Éric Seigne wrote:
>>
>> Hello,
>> here is my "proof of concept" ...
>>
>> if you could extract, build and explain to me what i'm doing wrong ?
> You can't use the standard c++ exec() within the Android Runtime
> Environment because it is not a running the Posix Standard Runtime in
> Android.  It is running other runtime environment depending on your
> Android version. Dalvik or Art or whatever else as mentioned in the
> previous email.
> 
> You have to rely on the QAndroidJniObject to get you there.  You
> translate every line of java above into something from QAndroidJniObject
> calls can understand.
> 
> 
>>
>> thanks,
>> Éric
>>
>> Le 28/02/2014 23:16, Éric Seigne a écrit :
>>> Hello David,
>>> thanks a lot for helping me, but i'm a Qt/c++ only developper, there is
>>> 0 java code lines in app1 or app2 :o)
>>>
>>> in other os i just make a qprocess to launch app2 from app1
>>>
>>> Éric
>>
>>
>>
>> _______________________________________________
>> Android-development mailing list
>> Android-development at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/android-development
>>
> 




More information about the Android-development mailing list