R RanSoft Member Licensed User Longtime User Feb 28, 2016 #1 Good morning I need to run in the background a service for notifications. The service continues if I go out simply from the app - OK Problems: If I close the app, the service ends. It does not start when you start Android, despite #StartBoot. Download here the source code ... http://www.ransoft.it/download/notify.zip Thank you.
Good morning I need to run in the background a service for notifications. The service continues if I go out simply from the app - OK Problems: If I close the app, the service ends. It does not start when you start Android, despite #StartBoot. Download here the source code ... http://www.ransoft.it/download/notify.zip Thank you.
DonManfred Expert Licensed User Longtime User Feb 28, 2016 #2 Massimo Ranallo said: If I close the app, the service ends. It does not start when you start Android, despite #StartBoot. Click to expand... This is expected in newer android versions. If the User explicitely kills a app then Android will not start the Service unless the user explicitely start the app again. Don´t kill the app with a taskmanager. LEt android decide when to kill our app (or not)... Upvote 0
Massimo Ranallo said: If I close the app, the service ends. It does not start when you start Android, despite #StartBoot. Click to expand... This is expected in newer android versions. If the User explicitely kills a app then Android will not start the Service unless the user explicitely start the app again. Don´t kill the app with a taskmanager. LEt android decide when to kill our app (or not)...
R RanSoft Member Licensed User Longtime User Feb 28, 2016 #3 ... It does not start when you start Android, despite #StartBoot ... Upvote 0
lemonisdead Well-Known Member Licensed User Longtime User Feb 28, 2016 #4 Yes, you can test that workaround : register a broadcast receiver from the Manifest like this Code: Copy AddReceiverText(Your_Service_Name, <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter>) Plus : you have to check if your app is not installed on the external storage (on some phones app installed there won't start at boot) Upvote 0
Yes, you can test that workaround : register a broadcast receiver from the Manifest like this Code: Copy AddReceiverText(Your_Service_Name, <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED"/> </intent-filter>) Plus : you have to check if your app is not installed on the external storage (on some phones app installed there won't start at boot)
R RanSoft Member Licensed User Longtime User Feb 28, 2016 #5 Does not work. Download here the source code ... http://www.ransoft.it/download/notify.zip Check the operation and send me the correct project. I am willing to donate... Thank you Upvote 0
Does not work. Download here the source code ... http://www.ransoft.it/download/notify.zip Check the operation and send me the correct project. I am willing to donate... Thank you
R RanSoft Member Licensed User Longtime User Feb 28, 2016 #6 DonManfred said: This is expected in newer android versions. If the User explicitely kills a app then Android will not start the Service unless the user explicitely start the app again. Don´t kill the app with a taskmanager. LEt android decide when to kill our app (or not)... Click to expand... But whatsapp, how it works? The notification arrives when it was forcibly closed ... Upvote 0
DonManfred said: This is expected in newer android versions. If the User explicitely kills a app then Android will not start the Service unless the user explicitely start the app again. Don´t kill the app with a taskmanager. LEt android decide when to kill our app (or not)... Click to expand... But whatsapp, how it works? The notification arrives when it was forcibly closed ...
lemonisdead Well-Known Member Licensed User Longtime User Feb 28, 2016 #7 Massimo Ranallo said: But whatsapp, how it works? The notification arrives when it was forcibly closed ... Click to expand... The problem with people who don't read advices is that they don't read advices... Your project is attached. Attachments Notify.zip Notify.zip 6.4 KB · Views: 392 Upvote 0
Massimo Ranallo said: But whatsapp, how it works? The notification arrives when it was forcibly closed ... Click to expand... The problem with people who don't read advices is that they don't read advices... Your project is attached.
R RanSoft Member Licensed User Longtime User Feb 28, 2016 #8 I tried to download the attached project, but does not work. The service ends if I close the app forcibly. Does not display more 'ToasMassage. Upvote 0
I tried to download the attached project, but does not work. The service ends if I close the app forcibly. Does not display more 'ToasMassage.
lemonisdead Well-Known Member Licensed User Longtime User Feb 28, 2016 #9 That's what DonManfred said : if you kill the app, it will restart only at boot (to be clear : when the phone/tablet is restarted ; subject of your initial question) Upvote 0
That's what DonManfred said : if you kill the app, it will restart only at boot (to be clear : when the phone/tablet is restarted ; subject of your initial question)
lemonisdead Well-Known Member Licensed User Longtime User Feb 28, 2016 #10 Massimo Ranallo said: The service ends if I close the app forcibly. Click to expand... Please try the new project attached Attachments Notify1.zip Notify1.zip 6.5 KB · Views: 365 Upvote 0
Massimo Ranallo said: The service ends if I close the app forcibly. Click to expand... Please try the new project attached
R RanSoft Member Licensed User Longtime User Feb 28, 2016 #11 To me it does not work. It works on your Android? Upvote 0
lemonisdead Well-Known Member Licensed User Longtime User Feb 28, 2016 #12 Yes or i wouldn't have send it to you. Sorry if it doesn't work Upvote 0
M Mahares Expert Licensed User Longtime User Feb 28, 2016 #13 lemonisdead said: That's what DonManfred said : if you kill the app, it will restart only at boot Click to expand... DonManfred says this: If I close the app, the service ends. It does not start when you start Android, despite #StartBoot. Therefore, the service will not start at boot. Here is the test I conducted: 1. Installed and ran in release mode on a device with 4.2.2 OS. runs ok 2. Force close app. 3. Completely power off device. 4. Restart device, app does not restart. EDIT: if you do not force close the app, the service restarts at boot ok. Merci Last edited: Feb 28, 2016 Upvote 0
lemonisdead said: That's what DonManfred said : if you kill the app, it will restart only at boot Click to expand... DonManfred says this: If I close the app, the service ends. It does not start when you start Android, despite #StartBoot. Therefore, the service will not start at boot. Here is the test I conducted: 1. Installed and ran in release mode on a device with 4.2.2 OS. runs ok 2. Force close app. 3. Completely power off device. 4. Restart device, app does not restart. EDIT: if you do not force close the app, the service restarts at boot ok. Merci
lemonisdead Well-Known Member Licensed User Longtime User Feb 28, 2016 #14 I am sorry : just made the test to be sure like this : Start the app with only start at boot. It shows the Toast at internal Kill the app or by swiping the activity or by the Stop button from Android settings \ Application Reboot : it won't restart. Insert the intent receiver in the manifest and do the same It shows the Toast Kill the app or by swiping or by the Stop button Restart the phone : it restarts the service I can make some video tomorrow if needed (the device is a Homtom HT6 Lollipop). About the second point : having the service continuing running : by putting the service as sticky one, it continues running if the app is killed by swiping and stops when using the Stop button. Last edited: Feb 28, 2016 Upvote 0
I am sorry : just made the test to be sure like this : Start the app with only start at boot. It shows the Toast at internal Kill the app or by swiping the activity or by the Stop button from Android settings \ Application Reboot : it won't restart. Insert the intent receiver in the manifest and do the same It shows the Toast Kill the app or by swiping or by the Stop button Restart the phone : it restarts the service I can make some video tomorrow if needed (the device is a Homtom HT6 Lollipop). About the second point : having the service continuing running : by putting the service as sticky one, it continues running if the app is killed by swiping and stops when using the Stop button.
somed3v3loper Well-Known Member Licensed User Longtime User Feb 28, 2016 #15 And check that your ROM allows your app to start at boot . I spent a few hours searching forum and internet while Huawei EMUI was blocking my app from starting at boot. Upvote 0
And check that your ROM allows your app to start at boot . I spent a few hours searching forum and internet while Huawei EMUI was blocking my app from starting at boot.