RetroShare / retroshare-mobile

Retroshare mobile phone client
24 stars 8 forks source link

Added background retorshare service. #41

Closed Kumaravinash9 closed 3 years ago

Kumaravinash9 commented 3 years ago
I/FeatureParser(28002): can't find curtana.xml in assets/device_features/,it may be in /vendor/etc/device_features
E/libc    (28002): Access denied finding property "ro.vendor.df.effect.conflict"
E/libc    (28002): Access denied finding property "ro.vendor.knock.type"
W/hare.retroshare(28002): type=1400 audit(0.0:1528437): avc: denied { read } for name="u:object_r:vendor_displayfeature_prop:s0" dev="tmpfs" ino=1369 scontext=u:r:untrusted_app_29:s0:c135,c257,c512,c768 tcontext=u:object_r:vendor_displayfeature_prop:s0 tclass=file permissive=0 app=com.miui.android.fashiongallery

@selankon now this problem arise after doing all the required changes.

Kumaravinash9 commented 3 years ago

After debugging it. It shows an error because of some permission issue when the app tried to run the background task. Here is the error log : PlatformException(PermissionError, The battery optimizations are not turned off., , null)

selankon commented 3 years ago

I forgot to add android permisions to the guide, check the android manifest https://gitlab.com/elRepo.io/elRepo.io-android/-/blob/develop/android/app/src/main/AndroidManifest.xml#L109

On August 21, 2021 10:46:26 PM GMT+02:00, Avinash Kumar @.> wrote: @. commented on this pull request.

  • if (!permissionHandler!!.isIgnoringBatteryOptimizations()) {
  • if (activity != null) {
  • permissionHandler!!.requestBatteryOptimizationsOff(result, activity!!)
  • } else {
  • result.error("NoActivityError", "The plugin is not attached to an activity", "The plugin is not attached to an activity. This is required in order to request battery optimization to be off.")
  • }
  • }
  • result.success(true)
  • }
  • "enableBackgroundExecution" -> {
  • // Ensure all the necessary permissions are granted
  • if (!permissionHandler!!.isWakeLockPermissionGranted()) {
  • result.error("PermissionError", "Please add the WAKE_LOCK permission to the AndroidManifest.xml in order to use background_sockets.", "")
  • } else if (!permissionHandler!!.isIgnoringBatteryOptimizations()) {
  • result.error("PermissionError", "The battery optimizations are not turned off.", "")

the problem is coming here because of not a required permission.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/RetroShare/retroshare-mobile/pull/41#pullrequestreview-735520475

selankon commented 3 years ago

Try to uninstall and install again. Maybe you need to request permision again

On August 22, 2021 1:09:47 PM GMT+02:00, Avinash Kumar @.> wrote: @. commented on this pull request.

Still not working

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/RetroShare/retroshare-mobile/pull/41#discussion_r693484848

Kumaravinash9 commented 3 years ago

Try to uninstall and install again. Maybe you need to request permision again On August 22, 2021 1:09:47 PM GMT+02:00, Avinash Kumar @.> wrote: @. commented on this pull request.

  • + + + + + + + + + + + + + + + Still not working -- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: #41 (comment)

Already tried it. Let me try it again. The steps I followed pervious :

Kumaravinash9 commented 3 years ago

Try to uninstall and install again. Maybe you need to request permision again On August 22, 2021 1:09:47 PM GMT+02:00, Avinash Kumar @.> wrote: @. commented on this pull request.

  • + + + + + + + + + + + + + + + Still not working -- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: #41 (comment)

It didn't work.

Kumaravinash9 commented 3 years ago

@csoler this issues is not removed yetPlatformException(PermissionError, The battery optimizations are not turned off., , null)

selankon commented 3 years ago

I mean to uninstall the application. You are not giving the correct permisions to the app from the android system

On August 22, 2021 8:35:53 PM GMT+02:00, Avinash Kumar @.***> wrote:

Try to uninstall and install again. Maybe you need to request permision again On August 22, 2021 1:09:47 PM GMT+02:00, Avinash Kumar @.> wrote: @. commented on this pull request.

  • + + + + + + + + + + + + + + + Still not working -- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: #41 (comment)

Already tried it. Let me try it again.

The steps I followed pervious :

  • Flutter clean

  • Flutter pub get

  • Flutter run

-- > You are receiving this because you were mentioned.

Reply to this email directly or view it on GitHub:

https://github.com/RetroShare/retroshare-mobile/pull/41#issuecomment-903311691

Kumaravinash9 commented 3 years ago

I mean to uninstall the application. You are not giving the correct permisions to the app from the android system On August 22, 2021 8:35:53 PM GMT+02:00, Avinash Kumar @.> wrote: > Try to uninstall and install again. Maybe you need to request permision again On August 22, 2021 1:09:47 PM GMT+02:00, Avinash Kumar @.> wrote: @.** commented on this pull request. > > > - + + + + + + + + + + + + + + + Still not working -- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: [#41 (comment)](#41 (comment)) Already tried it. Let me try it again. The steps I followed pervious : Flutter clean Flutter pub get Flutter run -- > You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: #41 (comment)

I have tried these steps. But didn't work. Do you mean I need to provide permission manually

selankon commented 3 years ago

@Kumaravinash9 what about this? You managed to fix the problem?

Kumaravinash9 commented 3 years ago

@Kumaravinash9 what about this? You managed to fix the problem?

No still same problem is coming. It's varies mobile to mobile.

selankon commented 3 years ago
 PlatformException(PermissionError, The battery optimizations are not turned off., , null)

This error above is a permission error, you didn't tap the "Ok" in the acceptance dialog when permissions are requested. You saw this dialog? What version of Android are you using? Exactly in what line of the code you see this error?

A related piece of code for this are:

 // Initialize RsServiceControl with default values
    rsControl.RsServiceControl.initialize().then((value) {
      print("RsServiceControl initialize Ok");
      await rsControl.RsServiceControl.enableBackgroundExecution();
      // Do whatever
    });

When you initialize the program tests all the permissions and asks for the permissions if they are not set. Check over:

https://gitlab.com/elRepo.io/elRepo.io-android/-/blob/develop/lib/RsServiceControl/rscontrol.dart#L57

https://gitlab.com/elRepo.io/elRepo.io-android/-/blob/develop/android/app/src/main/kotlin/net/altermundi/elrepoio/MainActivity.kt#L115

https://gitlab.com/elRepo.io/elRepo.io-android/-/blob/develop/android/app/src/main/kotlin/net/altermundi/elrepoio/PermissionHandler.kt#L55

The error maybe is because your Android version? :thinking:

Kumaravinash9 commented 3 years ago
 PlatformException(PermissionError, The battery optimizations are not turned off., , null)

This error above is a permission error, you didn't tap the "Ok" in the acceptance dialog when permissions are requested. You saw this dialog? What version of Android are you using? Exactly in what line of the code you see this error?

A related piece of code for this are:

 // Initialize RsServiceControl with default values
    rsControl.RsServiceControl.initialize().then((value) {
      print("RsServiceControl initialize Ok");
      await rsControl.RsServiceControl.enableBackgroundExecution();
      // Do whatever
    });

When you initialize the program tests all the permissions and asks for the permissions if they are not set. Check over:

https://gitlab.com/elRepo.io/elRepo.io-android/-/blob/develop/lib/RsServiceControl/rscontrol.dart#L57

https://gitlab.com/elRepo.io/elRepo.io-android/-/blob/develop/android/app/src/main/kotlin/net/altermundi/elrepoio/MainActivity.kt#L115

https://gitlab.com/elRepo.io/elRepo.io-android/-/blob/develop/android/app/src/main/kotlin/net/altermundi/elrepoio/PermissionHandler.kt#L55

The error maybe is because your Android version? 🤔

Hii @selankon Actually, whatever changes you mentioned above I have done this before. Maybe this problem with new devices like android 11 because when I tried to run this on older devices. It ran but on the newly launched phone, It did not work.

selankon commented 3 years ago

So on devices newer than android 10 doesn't work right? I haven't one to test. May we check about bettery optimizations permissions on Android 11 to fix this

selankon commented 3 years ago

@Kumaravinash9 have you tried something like this: https://stackoverflow.com/a/68634616/4708664 ? What phone model have the problem? I remember that MIUI had some special specifications.

Kumaravinash9 commented 3 years ago

I remember that MIUI had some special specifications.

Actually i am using readmi note 10 pro having MIUI.

selankon commented 3 years ago

Witch version of MIUI and Android?

Kumaravinash9 commented 3 years ago

Witch version of MIUI and Android?

MIUI Global 12.0.5 and Android version : 11

selankon commented 3 years ago

We have to investigate about MIUI, Android11 and the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission.

May we don't really need it?