Closed zazor1911 closed 8 years ago
Which API are you trying to use?
On Mar 24, 2016, at 2:58 PM, zazor1911 notifications@github.com wrote:
Hello! I'm trying to get intent with Broadcast Receiver after the launch of the service, and lock the device, but I get it only when my screen is unlocked. Can help me please?
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1
Activity API
You have to register the receiver in the AndroidManifest.xml. You cannot programatically register the receiver.
On Mar 24, 2016, at 3:14 PM, zazor1911 notifications@github.com wrote:
Activity API
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201047176
Yes, I register receiver like example: <receiver android:name=".PathsenseActivityUpdateBroadcastReceiver" />
Can you send me the code so I can look at it?
On Mar 24, 2016, at 3:21 PM, zazor1911 notifications@github.com wrote:
Yes, I register receiver like example: android:name=".PathsenseActivityUpdateBroadcastReceiver" />
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201050270
What part of the code? I've done every step of this example: https://github.com/pathsense/pathsense-samples-android/blob/master/pathsense-activitydemo-app/README.md
It should be working then, in the background or foreground.
What version of Android are you running. Also, what device?
On Mar 24, 2016, at 3:32 PM, zazor1911 notifications@github.com wrote:
What part of the code? I've done every step of this example: https://github.com/pathsense/pathsense-samples-android/blob/master/pathsense-activitydemo-app/README.md https://github.com/pathsense/pathsense-samples-android/blob/master/pathsense-activitydemo-app/README.md — You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201057700
I tried Samsung galaxy S3, Samsung galaxy S5, Lenovo P780, Sony z3, Android versions 4.4, 4.3 , 5.0, 5.1
Maybe this is due to lack of resources. So there was a problem on the foreground. Broadcasts stop coming after a while time. Although simple in backgrounds it works.
No, that is not the issue.
Actually, I know what it is. The demo/sample app is intended to display the results on the screen and run in the foreground. If you go into the MainActivity, you will see the unregistering from the api in the onPause.
If you want it to run in the background, comment out the onPause method. Then it will run indefinitely while the process is alive.
On Mar 24, 2016, at 3:46 PM, zazor1911 notifications@github.com wrote:
Maybe this is due to lack of resources. So there was a problem on the foreground. Broadskast stop coming after a while time. Although simple in backgrounds it works.
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201061540
Yes, I see. But I do not use unregister. I only register broadcast receiver in my main activity.
Like:
api = PathsenseLocationProviderApi.getInstance(this);
api.requestActivityUpdates(PathsenseActivityUpdateBroadcastReceiver.class);
Can you zip up the entire source and android manifest. I can take a look at it. It should work on the devices and OS you specified.
On Mar 24, 2016, at 3:55 PM, zazor1911 notifications@github.com wrote:
Yes, I see. But I do not use unregister. I only register broadcast receiver in my main activity.
Like:
api = PathsenseLocationProviderApi.getInstance(getApplicationContext()); api.requestActivityUpdates(PathsenseActivityUpdateBroadcastReceiver.class);
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201064465
I'm sorry I can not do it. But that is my Verbose logs which contains "pathsense", they coming than device is locked too. http://pastebin.com/RUB3GE8K
Are you using the latest version? 2.0.0.0?
On Mar 24, 2016, at 3:59 PM, John Dyer john@pathsense.com wrote:
Can you zip up the entire source and android manifest. I can take a look at it. It should work on the devices and OS you specified.
On Mar 24, 2016, at 3:55 PM, zazor1911 <notifications@github.com mailto:notifications@github.com> wrote:
Yes, I see. But I do not use unregister. I only register broadcast receiver in my main activity.
Like:
api = PathsenseLocationProviderApi.getInstance(getApplicationContext()); api.requestActivityUpdates(PathsenseActivityUpdateBroadcastReceiver.class);
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201064465
No, I using 1.0.0.2 version, cause him values is better for us. Last version give fail positive confidence for IN_VEHICLE when I was sitting at the table.
Can you switch to 2.0.0.0 just to test the same scenario and see if background works? It uses considerably less resources as 1.0.0.2.
On Mar 24, 2016, at 4:40 PM, John Dyer john@pathsense.com wrote:
Are you using the latest version? 2.0.0.0?
On Mar 24, 2016, at 3:59 PM, John Dyer <john@pathsense.com mailto:john@pathsense.com> wrote:
Can you zip up the entire source and android manifest. I can take a look at it. It should work on the devices and OS you specified.
On Mar 24, 2016, at 3:55 PM, zazor1911 <notifications@github.com mailto:notifications@github.com> wrote:
Yes, I see. But I do not use unregister. I only register broadcast receiver in my main activity.
Like:
api = PathsenseLocationProviderApi.getInstance(getApplicationContext()); api.requestActivityUpdates(PathsenseActivityUpdateBroadcastReceiver.class);
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201064465
I tried to change, did not help. http://pastebin.com/tvJaVCS0
@zazor1911 Just out of curiosity, when do you call api.removeActivityUpdates()
in your code?
That remove activity updates api.removeActivityUpdates()
That will remove the activity updates. Are you calling this in your MainActivity?
On Mar 24, 2016, at 5:34 PM, zazor1911 notifications@github.com wrote:
That remove activity updates api.removeActivityUpdates()
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201085388
And I tried that
if (Intent.ACTION_SCREEN_OFF.equals(action)) {
Runnable runnable = new Runnable() {
public void run() {
api.removeActivityUpdates();
api.requestActivityUpdates(PathsenseActivityUpdateBroadcastReceiver.class);
}
};
new Handler().postDelayed(runnable, 5000);
}
@dyerjo Yes, and that remove them
For now, comment out all references to api.removeActivityUpdates().
Once, you call api.requestActivityUpdates it will stay registered until you call remove. If you want the updates in the background, you do not need to do anything else.
On Mar 24, 2016, at 5:36 PM, zazor1911 notifications@github.com wrote:
And I tried that
if (Intent.ACTION_SCREEN_OFF.equals(action)) { Runnable runnable = new Runnable() { public void run() { api.removeActivityUpdates(); api.requestActivityUpdates(PathsenseActivityUpdateBroadcastReceiver.class); } }; new Handler().postDelayed(runnable, 5000); }
— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/pathsense/pathsense-samples-android/issues/1#issuecomment-201085606
Yes, it was before, I did not use the removal. In my opinion the service is running after device is locked too, but broadcast receiver not called. I also checked his work this way from locked device:
private String isServiceActiv(Context context) {
ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if (service.service.getClassName().toLowerCase().contains("pathsense")) {
return service.service.getClassName();
}
}
return null;
@zazor1911 Can you please email me at pablo@pathsense.com so we can dig deeper into this issue. Thanks!
Thanks!
Hello! I'm trying to get intent with Broadcast Receiver after the launch of the service, and lock the device, but I get it only when my screen is unlocked. Can help me please?