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

Dirk Hohndel dirk at hohndel.org
Fri Jun 29 07:29:36 CEST 2018


Ekke,

This is awesome. I browsed through your posts and cloned the SHAREexample.
I think it will take me a moment to follow this and understand how to apply this to my situation,
But this is by far the best explanation and best documented example that I've found, so thanks
to your information I'm much more optimistic that I should be able to figure this out.

I will post here if I  get stuck, but yeah... definitely a huge help!

/D

> On Jun 28, 2018, at 9:57 PM, ekke <ekke at ekkes-corner.org> wrote:
> 
> Dirk,
> 
> if your app was running this method will be called inside your Activity:
> 
> public void onNewIntent(Intent intent)
> 
> if your app wasn't running and started by the Intent, the App was started with
> 
> public void onCreate(Bundle savedInstanceState)
> 
> then you can see if there's an Intent causing the app start:
> 
> // now we're checking if the App was started from another Android App via Intent
>           Intent theIntent = getIntent();
>           if (theIntent != null){
>               String theAction = theIntent.getAction();
>               if (theAction != null){
>                   Log.d("ekkescorner onCreate ", theAction);
>                   // QML UI not ready yet
>                   // delay processIntent();
>                   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 <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/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
> 
> _______________________________________________
> Android-development mailing list
> Android-development at qt-project.org <mailto:Android-development at qt-project.org>
> http://lists.qt-project.org/mailman/listinfo/android-development <http://lists.qt-project.org/mailman/listinfo/android-development>

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


More information about the Android-development mailing list