CompanyGateways / mytracks

Automatically exported from code.google.com/p/mytracks
1 stars 0 forks source link

3rd party reuse of TrackList activity #457

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

...
startActivityForResult(
  new Intent() {{
    setClassName("com.google.android.apps.mytracks",
      "com.google.android.apps.mytracks.TrackList");
  }},
  SELECT_TRACK_REQUEST
);
...

What do you see instead?

...
android.content.ActivityNotFoundException: Unable to find explicit activity 
class 
{com.google.android.apps.mytracks/com.google.android.apps.mytracks.TrackList}; 
have you declared this activity in your AndroidManifest.xml?
...

I guess all is necessary from MyTracks side is to declare some explicit actions 
for TrackList activity in AndroidManifest.xml

Original issue reported on code.google.com by estee...@gmail.com on 10 May 2011 at 10:07

GoogleCodeExporter commented 9 years ago
Can you be more specific about what you want from the TrackList?

Original comment by sandordo...@google.com on 10 May 2011 at 10:15

GoogleCodeExporter commented 9 years ago
If all you want is to pick a track, then TrackList is probably not for you - it 
also gives options like deleting and sharing tracks. That's why it's explicitly 
set as export=false in our manifest.

Original comment by rdama...@google.com on 10 May 2011 at 11:34

GoogleCodeExporter commented 9 years ago
Thanks for responding!

Comment #2 states precisely what I wanted to accomplish. Sadly it's not 
possible. So how do i do the following from external app:

1) Pick existing track ID from a list
2) Display track by ID.
3) Get a given track stats (e.g.: avg. speed, altitude, timing)

As far as i can tell ITrackRecordingService can only help in controlling 
tracking, but not to do any of the above, doesn't it?

Original comment by estee...@gmail.com on 11 May 2011 at 6:18

GoogleCodeExporter commented 9 years ago
You can get all of that from the ContentProvider.  Your best bet is probably to 
copy out the bits of the code that you want into your project.  It is 
concievable that bits of our ui code could end up the MyTracksLib project which 
would make their reuse easier but that is not the way we have it set up now.  
If you do find bits of our UI code useful and generalizable in a way that the 
same class can be used in the main my tracks app and in your class please send 
a change which moves the classes you use from the MyTracks project to the 
MyTracksLib project.

Original comment by sandordo...@google.com on 11 May 2011 at 3:24

GoogleCodeExporter commented 9 years ago
Exactly - you can read our database through the provider (and there's a helper 
class for that, MyTracksProviderUtil, too). You can even get notified every 
time the tracks table changes by registering a ContentObserver.

About moving UI to the lib - if we want to go in that direction I'd like to 
plan first. More specifically, we could try to have cross-app UI elements 
(RemoteView), which would allow things like adding a new visualization inside 
My Tracks - e.g. if there's a calories burned application out there, it could 
still show its data as a plugin for My Tracks, and assuming the views in My 
Tracks itself would also fit in this model, then they'd also be usable outside. 
If you want to look into it let us know.

Original comment by rdama...@google.com on 11 May 2011 at 3:46

GoogleCodeExporter commented 9 years ago
Thank you for explanations!

Content provider seems to be exactly what i really wanted. So i've managed to 
implement tracks selection as per instructions above and no UI elements reuse 
was really necessary 
(http://code.google.com/p/wheelly/source/detail?r=264d29a5aea00aec06cc6fd8b600f4
ccad68d7e4). (BTW, i'm writing car managing app, so trying to outsource all the 
specific things such as tracking to third parties -- probably not exactly the 
job MyTracks was intended for, but still integration is smooth so far.)

As to track display, (re)using MyTracks UI: i didn't try it yet, but will 
report my findings here.

Original comment by estee...@gmail.com on 13 May 2011 at 8:23