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

Added for react native project #62

Closed
wants to merge 1 commit into from

Conversation

vandit560
Copy link

Intent flag added activity new task

Intent flag add flag activity new task for not working in Xiaomi or Redmi
@judemanutd
Copy link
Owner

@vandit560 could you elaborate a little more on how react native plays into this addition

@judemanutd judemanutd added enhancement New feature or request good first issue Good for newcomers labels Mar 24, 2021
@mbouxin
Copy link

mbouxin commented Mar 30, 2021

The "fix" here is dueto the fact that @vandit560 tried to call your lib through a react Native context which is an application context and not an Activity context. In this situation, calling another activity requires the added flag.

IMHO the actual solution would be to change the call in react native application by using something like
AutoStartPermissionHelper.getInstance().getAutoStartPermission(reactContext.getCurrentActivity())

@judemanutd
Copy link
Owner

@vandit560 could you make a change to accept a boolean parameter for the startIntent function. Based on the boolean, you can add an if clause around the FLAG_ACTIVITY_NEW_TASK so that way the end user can decide if they want to start the intent in the existing activity or a new task depending on their preference and use case.

awoisoak added a commit to awoisoak/AutoStarter that referenced this pull request Jun 4, 2021
It checks the existence of the activities before attempting to open them. Now if the activity can really not be opened, getAutoStartPermission will return false. Related issues:
judemanutd#29
judemanutd#30

isAutoStartPermissionAvailable is checking the existence of the activity in order to avoid 'false positives' when the library is not able to open a specific settings screen.


Inverted the Huawei intents to process the newer ones first (I didn't invert the rest of the manufacturers as I can't test all of them). This fix known issue with Huawei P 10 Lite 
judemanutd#38 (tested)


Use Build.BRAND.toLowerCase(Locale.ROOT) to avoid issues with certain languages as Turkish as mentioned here:
judemanutd#66 (tested)


Includes FLAG_ACTIVITY_NEW_TASK so that it can be called outside an Activity.
Fixed this:
judemanutd#62


Add a new activity to be opened in Samsung devices as: 
This one open the exact Sleeping Apps setting
com.samsung.android.lool/com.samsung.android.sm.battery.ui.usage.CheckableAppListActivity
While this one opens the main battery settings
com.samsung.android.lool/com.samsung.android.sm.battery.ui.BatteryActivity

That should fixes theses (Tested with Note 8, Note 9 & Note 20):
judemanutd#37
judemanutd#33
@awoisoak awoisoak mentioned this pull request Jun 4, 2021
@judemanutd
Copy link
Owner

Thanks for the PR, closing this one since it should be resolved in #69

@judemanutd judemanutd closed this Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants