[Android-development] [Interest] responding to an Android intent in a Qt app

ekke ekke at ekkes-corner.org
Fri Jun 29 06:57:21 CEST 2018


Dirk,

if your app was running this method will be called inside your Activity:

publicvoidonNewIntent(Intentintent)


if your app wasn't running and started by the Intent, the App was
started with

publicvoidonCreate(BundlesavedInstanceState)


then you can see if there's an Intent causing the app start:

//nowwe'recheckingiftheAppwasstartedfromanotherAndroidAppviaIntent

IntenttheIntent=getIntent();

if(theIntent!=null){

StringtheAction=theIntent.getAction();

if(theAction!=null){

Log.d("ekkescorneronCreate",theAction);

//QMLUInotreadyyet

//delayprocessIntent();

isIntentPending=true;

}

}


Attention: if your app was started by the Intent, then at this point
your UI isn't ready,
so it's a good idea to set a bool isIntentPending
and as soon as your App UI is ready you can ask if there was an Intent
and process your logic

to get the whole story, see this example app:
https://github.com/ekke/ekkesSHAREexample
and my blogs:
http://blog.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app/
http://blog.qt.io/blog/2018/01/16/sharing-files-android-ios-qt-app-part-2/
<http://blog.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app/>
http://blog.qt.io/blog/2018/02/06/sharing-files-android-ios-qt-app-part-3/
<http://blog.qt.io/blog/2017/12/01/sharing-files-android-ios-qt-app/>

hope you get the idea HowTo get the data from your Intent
I haven't used

action.USB_DEVICE_ATTACHED

so cannot help with this in detail, but will add this usecase next weeks

ekke
Am 28.06.18 um 19:32 schrieb Dirk Hohndel:
> Hi,
> ...
>
> Here comes the question - inside the app, how do I know that I was
> launched by that intent? And how do I get to the extra data that is
> available through that intent?
>
> ....
> Thanks
>
> /D

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/android-development/attachments/20180629/8f37a217/attachment.html>


More information about the Android-development mailing list