[Interest] Android services

Jason H jhihn at gmx.com
Mon Mar 7 20:02:10 CET 2016


I am willing to write as much android code as I need That is to say I was hoping to extend QtActivity, and have the QtActivity talk to the service as if it were a proper Android app, as well as code the service in Android SDK. I have the luxury of being able to mostly coordinate things through the database (save for kicking off the service) so I think I should be ok. But MyActivity (extends QtActivity) does not seem to start the service, even with startIntent() (The service class, extending IntentService never even gets created!?)


> Sent: Monday, March 07, 2016 at 1:04 PM
> From: "Pendleton, Corey" <Corey.Pendleton at garmin.com>
> To: "Jason H" <jhihn at gmx.com>
> Cc: "interest at qt-project.org" <interest at qt-project.org>
> Subject: RE: [Interest] Android services
>
> Yeah, we have the same challenge. Our current workaround is to launch our Activity as a sticky activity, and then push it to the background after it starts processing events. Hopefully, that keeps it invisible to device users at startup, but gets our service running in-process. It's an ugly hack, but we hope Qt can work on this or perhaps we can help by contributing eventually.
> 
> Corey
> 
> -----Original Message-----
> From: Jason H [mailto:jhihn at gmx.com] 
> Sent: Monday, March 07, 2016 11:55 AM
> To: Pendleton, Corey <Corey.Pendleton at garmin.com>
> Cc: interest at qt-project.org
> Subject: Re: [Interest] Android services
> 
> Thanks, but
> 1. I need it now.
> 2. "The Android Application running can now have a QtActivity or a QtService, but having both in the same process is not supported."
> 
> Both of which are deal-breakers. It's be nice to know if I can work around the limitation of the patch?
> 
> 
> 
> 
> > Sent: Monday, March 07, 2016 at 12:46 PM
> > From: "Pendleton, Corey" <Corey.Pendleton at garmin.com>
> > To: "interest at qt-project.org" <interest at qt-project.org>
> > Subject: Re: [Interest] Android services
> >
> > You might find this interesting: 
> > https://bugreports.qt.io/browse/QTBUG-37221
> > According to the patch associated with that report: https://codereview.qt-project.org/#/c/149018/ this feature may be available to you with Qt 5.7.
> > 
> > Corey
> > 
> > -----Original Message-----
> > From: md at rpzdesign.com [mailto:md at rpzdesign.com]
> > Sent: Friday, March 04, 2016 5:50 PM
> > To: interest at qt-project.org
> > Subject: Re: [Interest] Android services
> > 
> > Why don't you create a skeleton test app and share with the group the source code.
> > 
> > I sent you a reply message yesterday suggesting the Android Job API.
> > 
> > You might find sweeter fruit using that.
> > 
> > md
> > 
> > 
> > On 3/4/2016 4:46 PM, Jason H wrote:
> > > So I am trying to implement a background service and it's not going very well. The service is being used to upload files when the UI is suspended.
> > >
> > > My usage differs from the http://www.kdab.com/qt-android-episode-7/ tutorial in a number of ways.
> > >
> > > 1. I have a Qt App
> > > 2. I have a subclassed QtActivity
> > > 3. I have a subclassed IntentService 4. The intent service calls the 
> > > native statics functions.
> > > 5. I've added <service android:name=".MyUploadService" android:exported="false" android:enabled="true"/> to the manifest, and spec'd MyActivity as the activity.
> > >
> > >
> > > 6. MyActivity::onCreate calls:
> > >          Intent serviceIntent = new Intent(this, MyUploadService.class);
> > >          startService(serviceIntent);
> > >
> > > And that's where it stops.
> > >
> > > In my MyUploadService,
> > > 1. None of the below gets logged:
> > >      @Override
> > >      public MyUploadService() {
> > >          super("MyUploadService");
> > >          java.lang.System.out.println(this.getClass().toString() + " Initialized");
> > >      }
> > >
> > >      @Override
> > >      public void onCreate() {
> > >          java.lang.System.out.println(this.getClass().toString() + " Created");
> > >      }
> > >
> > >      @Override
> > >      public void onHandleIntent(Intent workIntent) {
> > >          java.lang.System.out.println(this.getClass().toString() + " onHandleIntent");
> > >          ...
> > >      }
> > >
> > > Once the service is started, it is occasionally sent messages for work to do. But it doesn't get that far.
> > >
> > >
> > > Help?
> > >
> > > _______________________________________________
> > > Interest mailing list
> > > Interest at qt-project.org
> > > http://lists.qt-project.org/mailman/listinfo/interest
> > >
> > 
> > 
> > 
> > ________________________________
> > 
> > CONFIDENTIALITY NOTICE: This email and any attachments are for the sole use of the intended recipient(s) and contain information that may be confidential and/or legally privileged. If you have received this email in error, please notify the sender by reply email and delete the message. Any disclosure, copying, distribution or use of this communication (including attachments) by someone other than the intended recipient is prohibited. Thank you.
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
> > 
> 



More information about the Interest mailing list