Open chambm opened 2 months ago
dumb question.. were you reading the conversation going on this afternoon.. or just reading our minds? :smiley:
I'm planning on adding support for the presence of extras in the Intent.. and allow them to conditionally either:
Having said that.. most 3rd party software that supports sharing geo-Intents won't allow you to configure additional custom extras. But for somebody inventive, it wouldn't be too hard to write an app that intercepts, modifies, and resends. Or, as you mentioned earlier, such Intents could be started from either the command-line or pre-configured with an app like Bookmarks.
I'm going to work on it this afternoon.. and will get back to you with the finer details after they've all been ironed out.
Sounds good, thanks for the quick reply!
Isn't it possible to show the [fixed position | trip origin | trip destination | add bookmark] options as associated activities (I'm not sure of the term) that show up when you press "geo:" in OsmAnd? That would maximize compatibility (at the cost of spamming the "Open with" menu: so can adding the extra intents/activities be optional?).
Basically instead of:
Open with
Google Earth Maps Mock my GPS OsmAnd
Just once Always
we would see
Open with
Google Earth Maps Mock my GPS (fixed position) Mock my GPS (trip origin)
Mock my GPS (trip destination) Mock my GPS (add bookmark) OsmAnd
Just once Always
Then I could even set "trip destination" as the default and, with the smart behavior described above (immediately starting a new trip to that destination, using the current mocked position as the trip origin), it would be super convenient to just move around from place to place from OsmAnd.
I just released an updated version that includes support for extras in the Intent.
To address your suggestion..
I'll need to change which commit this tag is associated with.. because I've added this helper utility ("Mock Silently") to the repo in a subsequent commit, and it doesn't change either of the other pre-existing apps.. so no need for a new tag w/ rebuild.
at the moment, I haven't translated its strings yet.. but I added the APK for its english-only build to the v2.4.0 release.
I tested it out a bit.. and it works great.
update: replaced the english-only APK for one with all (51x) language translations, and updated the tag to reference the most-recent commit.
so, just to recap..
using this utility app:
your use-case was to:
Awesome, thanks for the lightning fast solution! From my testing, it works great as long as the mocking is turned on. If it's stopped, then the UI is still shown. Can "automatic start" be added as a boolean extra that Mock Silently would presumably always set to true?
This standalone utility makes me (giddily) wonder whether it can run on the non-owner profile and send intents to the Mock my GPS service running on the owner profile? Does it just need a user id (0) to make that work?
Is this work profile stuff applicable to the arbitrary user profiles available on a Samsung Galaxy Tab? https://developer.android.com/work/managed-profiles#java
If a device has a work profile, there are implications for apps running on the device, no matter which profile the app is running under:
By default, most intents do not cross from one profile to the other. If an app running on profile fires an intent, there is no handler for the intent on that profile, and the intent is not allowed to cross to the other profile due to profile restrictions, the request fails and the app may shut down unexpectedly.
Does this mean all that needs to be done is somehow configure Mock my GPS to allow cross-profile geo intents?
From my testing, it works great as long as the mocking is turned on. If it's stopped, then the UI is still shown. Can "automatic start" be added as a boolean extra that Mock Silently would presumably always set to true?
Yes. I like this idea. I could add a new (boolean) extra "force_start" which would only apply when "purpose" = 1 (fixed position). It couldn't be applied to start a trip when provided a new destination, because a trip also requires an origin.
I'll update both "Mock my GPS" to accept this new extra, as well as "Mock Silently" to support setting its value. I think I'll also update the PreferenceActivity in "Mock Silently" to conditionally show/hide extras based on the value chosen for "purpose".. to reduce confusion.
If a device has a work profile, there are implications..
Though I don't have any 1st-hand experience with this, the documentation that you linked to clearly says:
So, depending on your use-case.. if you plan on firing a geo-Intent from one profile and plan on it being handled by an app running in another.. then you need to configure your profiles to allow this. I'm not sure what level of granularity is available for this configuration.. but you would need to learn more about it.
a new version has been released that includes support for the force_start
extra..
in both "Mock my GPS" and "Mock Silently".
The idea of letting OsmAnd provide the mapping interface is great. But to make it convenient to use Mock my GPS from OsmAnd, we should be able to specify the purpose of sending the geo intent without opening the Mock my GPS UI. It should send the intent, have it take effect (change location), and then go back to the map. I shouldn't really have to see the Mock my GPS UI, or at least there should be an option for it.
So the feature request has three parts:
A bonus convenience option would be to have consecutive "trip destination" intents, without intervening "trip origin" intents, change the "trip origin" to the current location automatically. For example: User sends trip origin intent of 42,42 User sends trip destination intent of 44,44; trip starts automatically and holds at destination User sends trip destination intent of 43,43; trip starts automatically from 44,44 to 43,43