Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Start collecting GPS data on boot up #19

Open
Traxtar928 opened this issue Sep 3, 2019 · 29 comments
Open

Auto Start collecting GPS data on boot up #19

Traxtar928 opened this issue Sep 3, 2019 · 29 comments
Labels

Comments

@Traxtar928
Copy link

When android boots up, auto-start the app and begin collecting GPS data for seamless start of maps application, or other applications that require GPS data to function properly.

Currently, I have to manually go into the app and start the GPS collection every boot up.

Implementing this feature will be very useful for those that use an android device as a GPS/navigation system and the device constantly powers on/off with a vehicle/boat/etc.

@freshollie
Copy link
Owner

freshollie commented Sep 3, 2019

Hi.

From the README:

The application's background service can be set to start when the device turns on.
Currently the service does not automatically start when the GPS device is plugged
into the Android device due to more unwanted usb popups.

For now the background service can be manually started with a start service intent.

Intent intent = new Intent();
intent.setComponent(
	new Component(
		"org.broeuschmeul.android.gps.usb.provider",
		"org.broeuschmeul.android.gps.usb.provider.driver.USBGpsProviderService"
	)
)
intent.setAction("org.broeuschmeul.android.gps.usb.provider.action.START_GPS_PROVIDER")

Or via a shell command as root.

am startservice -a org.broeuschmeul.android.gps.usb.provider.action.START_GPS_PROVIDER -n org.broeuschmeul.android.gps.usb.provider/.driver.USBGpsProviderService

The background service will automatically close itself when the USB device is disconnected for too long.

I also recommend checking out my other app: headunit-controller which can do this for you, though is not as customisable as Tasker

@Traxtar928
Copy link
Author

I have 'start service on boot' selected, but I still have to manually turn on the 'Start/Stop GPS' toggle every time the android box powers on. Will the shell command you referenced from the readme address this?

@freshollie
Copy link
Owner

The start service on boot should do what you desire. If it's not working, I guess it might be because the USB device is not ready? The shell command will work, but I would imagine you just need to use a tasker delay in order to make it work.

@Traxtar928
Copy link
Author

Traxtar928 commented Sep 3, 2019

Great. I'll try it and report back. So far, 'start service on boot' is not working. If it works fine for you, using the GlobalSat BU-353-S4, maybe I should switch to that from the ND-105C. The BeeLink GT King android box I'm using has a pretty quick startup time, and the ND-105C dongle always stays plugged in with a start time of ~35 seconds max (averages about 15 seconds).

I've also tried it on a Samsung S7, just to ensure that it's not the android device causing the startup issue, and I have to manually toggle 'Start/Stop GPS' on that device as well, even with the 'start service on boot' checkbox enabled.

@freshollie
Copy link
Owner

Btw. For your screen brightness control I recommend autobright and headunit-controller will start this on startup too.

Yeah, not sure exactly if the start service on boot does work for my setup, I made it a long time ago as a feature request and I didn't need to use it on my setup. Does your box do a full system start when you start your car? I might be able to add a delay to the boot start which might fix the issue.

@Traxtar928
Copy link
Author

The box does do a full system start... I have it wired to accessories, so the power is cut when the vehicle is off.

If it helps, right after it boots into android I am able to IMMEDIATELY go into the app and toggle 'Start/Stop GPS' and it will start getting satellite data right away, so it doesn't seem to be a delay issue or timing issue. Whatever happens in the software when that 'Start/stop GPS' is toggled just needs to have an option to be turned on immediately when the app starts.

I can then automate the UsbGps4Droid app to turn on after the OS startup process in your headunit-contoller app.

In my mind, should be an easy implement... not sure about in practice, though. Great job, either way.

@Traxtar928
Copy link
Author

Did you happen to confirm that the app can auto starts collecting GPS data on boot? I want to confirm it's not my device that's causing the problems.

I also tried headunit-controller, but it caused my device to lag terribly. I posted the issue on that app's github page.

@freshollie
Copy link
Owner

Hi @Traxtar928. I have not been able to confirm this. Circumstance currently means that the car I developed this system with is not used by me anymore, and I do not have access to it. Did you manage to solve these issues?

@Traxtar928
Copy link
Author

Traxtar928 commented Nov 13, 2019 via email

@Traxtar928
Copy link
Author

Traxtar928 commented Nov 13, 2019 via email

@freshollie
Copy link
Owner

freshollie commented Nov 13, 2019

Ok. Firstly can you try this?

am start-foreground-service -a org.broeuschmeul.android.gps.usb.provider.action.START_GPS_PROVIDER org.broeuschmeul.android.gps.usb.provider/.driver.USBGpsProviderService

Instead of what I recommended.

If you want the app to automatically restart itself on reboot instead, can you look into downgrading the app? https://github.com/freshollie/UsbGps4Droid/releases/tag/v2.1.3

I think this might be because on API 26+ you can't start a service in the background on boot, and v2.1.3 is on API 25.

If so, I will either look into updating the latest app to work on API 26+ or downgrade the whole app to 25 again.

@Traxtar928
Copy link
Author

Traxtar928 commented Nov 14, 2019 via email

@JanRSmit
Copy link

JanRSmit commented Dec 3, 2019

I am curious to know if there is there any result?

@freshollie freshollie added the bug label Dec 3, 2019
@freshollie
Copy link
Owner

@JanRSmit yeah, this is definitely a bug since upgrading the SDK to API 26. I will get some time over christmas (hopefully) to test fixing the latest release to work with restarts.

@Traxtar928
Copy link
Author

Traxtar928 commented Dec 3, 2019 via email

@invisible789
Copy link

Auto start not working for me too, at reboot it always ask for default permissions for attached usb and service is off, indeed few settings for the app like root permission for system time from gps is lost, else settings remain intact but I've to manually start the service as well
I'm scratching my head why it always ask for usb default settings on every boot
Please help

@freshollie
Copy link
Owner

@invisible789 the permission popup is an android issue, it requires authorising USB devices for every reboot, or if the device disconnects. Your only solution is this: https://github.com/freshollie/UsbGps4Droid#usb-permissions-popup

As far as the service not auto starting, I never got a chance to look into the Android 9 issues. Are you running android 9?

@invisible789
Copy link

No, I'm at android 7.1.2 ATV OS, I'm not that learned to Create a new SYSYTEMUI.APK, can I get such help to send you APK and you modify it and share it with so i can replace,, i may be asking too much 🥇

@invisible789
Copy link

Just for info, such permission is not required in Another app , i'm not quoting its name here, untill you give permission to, its highly unethical , should i share that app name, that app doesn't require any usb permissions again & Again at every reboot , that app source code may be of help to you?

@freshollie
Copy link
Owner

Yeah, would be helpful for me to have a look, if the app is open source.

@invisible789
Copy link

here's play store link for the app, The app supported other than ppm until version 2.6.0.2 and it never asked usb gps permission except once at first install of the app, it never asks back for usb permissions at all and autostart right away
https://play.google.com/store/apps/details?id=de.pilablu.gnsscommander&hl=en
it may be of help to community i hope :)

@invisible789
Copy link

here's direct link to version 2.6.0.2
https://mega.nz/file/Kk4iXZYR#1lxtP_wRH907hD498sZ6CpkDuGITrSw7S56-qehwLcw

@Traxtar928
Copy link
Author

Traxtar928 commented Sep 29, 2020 via email

@invisible789
Copy link

@Traxtar928
Remove usbgps for to work everything properly
Than your mock location will be set to this app and auto start will work, that's what happens to me

@freshollie
Copy link
Owner

I'm a bit confused why you need this app if the other one works @invisible789?

@Traxtar928
Copy link
Author

Traxtar928 commented Sep 30, 2020 via email

@invisible789
Copy link

I'm a bit confused why you need this app if the other one works @invisible789?

Actually your app uses minimum resources on the system , and it's the best part of it, moreover it's accurate & up-to-date, dear apology if i hurt you by sharing other app, looking forward for your super worked app future updates :)

@Traxtar928
Copy link
Author

Traxtar928 commented Sep 30, 2020 via email

@invisible789
Copy link

That's a valid reason. I also prefer UsbGps because it's simple, to the point, programed well, users almost no resources (I have not compared... Have you?), and serves its purpose with no additional frills. If the auto start worked, it would be the perfect app for my needs.

On Wed, Sep 30, 2020, 1:19 PM invisible789 @.***> wrote: I'm a bit confused why you need this app if the other one works @invisible789 https://github.com/invisible789? Actually your app uses minimum resources on the system , and it's the best part of it, moreover it's accurate & up-to-date, dear apology if i hurt you by sharing other app, looking forward for your super worked app future updates :) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#19 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALGGE5TE45UVSTMCCZ3ANA3SINZBLANCNFSM4ITHX6YQ .

Exactly ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants