- XDA App
- Xda developers android app development
- Why are APIs hidden?
- Why use hidden APIs?
- How are hidden APIs restricted?
- How to bypass the hidden API blacklist
- ADB Workaround
- Native/JNI workaround
- Android 9 and 10
- Android 9 and later
- Java workaround
- Android 9 and 10
- Android 9 and later
- Conclusion and More Info
- Usage
- Checking Availability
- Granting Permission
- Checking
- Requesting
- Using APIs
- User Service
- Defining an AIDL
- Implementing the AIDL
- Setting up the Service Connection
- Creating the User Service arguments
- Starting, Stopping, and Binding the User Service
- Invoking the User Service
- Conclusion
- Using Coroutines
- Implementing a CoroutineScope
- Replacing AsyncTask with Coroutines
- Returning values with async
- Using withContext
- Conclusion
- Gradle Setup
- Using View Binding
- Class Name Syntax
- Instantiating with Existing View
- Instantiating with New View
- Referencing Views
- Conclusion
- Shell Access
- Listing Installed Apps through ADB
- Options
- Installing & Uninstalling Apps through ADB
- Installing an APK
- Options
- Multiple APKs and Bundles
- Uninstalling an App
- Extracting APKs with ADB
- Listing App Components
- Launching Activities, Services, and BroadcastReceivers
- Disabling & Enabling almost any App
- Update 1: More details shared during July 2021 policy update
- Update 2: Now rolling out
- Flutter 2.5
- Full Screen in Android
- Material You
- IDE Plugins
- IntelliJ/Android Studio
- Visual Studio Code
- Pigeon
- Dart 2.14
- Apple Silicon
- Lint Conditions
- Conclusion
XDA App
The best way to access the XDA forums from your Android device is to use the official XDA app. This app is designed to give users full access to the forums where you can post, search, reply, or track your favorite threads. You can start using the XDA App for free using a new or existing XDA forums account.
The XDA app gives you a combination of our front-page news stories, as well as access to the forums. You’ll be able to receive notifications for important things like replies or new conversations. Keep track of the forums for devices you own by managing your devices. The app will give you direct shortcuts to the forums for those devices that will show up on your main screen.
Your main forums page can also show you all of your watched threads. This brings all of the relevant forum content to a single page that can be accessed at a glance. Use simple gestures to manage your threads and the information you’ll get notifications on.
Check out popular threads under the trending tab, which will show you the threads with the most activity. Then you can view and manage your notifications from the bell icon. You’ll get notifications on replies, messages, achievements, and more.
Your achievements can earn you badges that will be displayed on your profile. This will show other users your different accomplishments. You can also keep track of your overall points that you receive from participating in the forums.
The swipe gestures that are used to manage forums, threads, and posts can be customized in the settings. You can set your default tab and feed to be your own preferred landing pages. More settings let you use the dark mode, security features, notification preferences, account details, and more.
You can download the XDA app for free from the Google Play store. If you have any suggestions or bugs to report, you can do that here.
Источник
Xda developers android app development
Tue, 09 Nov 2021 14:00:52 +0000
https://www.xda-developers.com/?p=551295 https://www.xda-developers.com/qualcomm-announces-snapdragon-spaces/feed/ 0 GitHub announces web command palette, revamped Issues, and much more
https://www.xda-developers.com/github-announces-web-command-palette-revamped-issues-and-much-more/ https://www.xda-developers.com/github-announces-web-command-palette-revamped-issues-and-much-more/#respond
Wed, 27 Oct 2021 19:29:42 +0000
https://www.xda-developers.com/?p=545435 https://www.xda-developers.com/github-announces-web-command-palette-revamped-issues-and-much-more/feed/ 0 Advanced Android Development: How to bypass the hidden API blacklist
https://www.xda-developers.com/bypass-hidden-apis/ https://www.xda-developers.com/bypass-hidden-apis/#respond
Fri, 08 Oct 2021 14:30:44 +0000
https://www.xda-developers.com/?p=457977 @hide annotation inside a comment block above them.
This annotation instructs whatever tool Google uses when compiling the SDK to exclude the item under it. That SDK is then distributed to developers inside the SDKs downloaded through Android Studio. Unless you use a modified SDK, Android Studio will think any of those hidden items just don’t exist. If you try to use one directly, it will show it in red and refuse to compile.
Why are APIs hidden?
There are a lot of reasons why an API might be hidden. Some things are only meant to be used by internal or system apps and won’t work if used by a third-party app. Others are experimental or unstable, and might be removed or changed in the future. Some are even just APIs Google just doesn’t want to apple the normal deprecation cycle to if they’re ever removed.
Why use hidden APIs?
While the standard Android SDK has a lot in it, sometimes it’s not enough. Sometimes there’s something you want to do that already exists in Android, but just isn’t publicly exposed.
For instance, a lot of the apps I make, including SystemUI Tuner and Lockscreen Widgets, make use of a bunch of different hidden APIs. SystemUI Tuner needs to access some to properly track, change, and reset options. Lockscreen Widgets uses some to show the wallpaper under it, among other things.
Most developers don’t need to access hidden APIs, but sometimes they can be pretty useful.
How are hidden APIs restricted?
With the release of Android 9 (Pie), Google introduced the hidden API blacklist. Not every hidden API was included, and there were different levels of lists. Hidden APIs on the whitelist could be accessed by anyone. Hidden APIs on the light-greylist could be accessed by any app, but might be inaccessible in future versions of Android. Anything on the dark-greylist could only be accessed by apps targeting API levels before Pie (i.e., before API level 28). Apps targeting Pie and later would be denied access. Finally, hidden APIs on the blacklist couldn’t be accessed by any non-system (or non-whitelisted) app, no matter the target API.
Android 10 changed how the lists were organized, and simplified them slightly, but the idea stayed the same. Certain hidden APIs could be accessed by apps while others were blocked. Android 11 strengthened the access detection to block a bypass used for Pie and 10.
In all Android versions, any time a third-party app attempts to access a blacklisted hidden API, Android will throw the appropriate “not found” error.
How to bypass the hidden API blacklist
There are actually quite a few ways to get past the hidden API blacklist. Depending on your needs, you can choose ones that work for all Android versions, ones that work for only Android 9 and 10, ones that use native C++ code, and ones that are fully Java-based. There’s even a development-only workaround using ADB.
ADB Workaround
If your device is running Android Pie, run the following two ADB commands to enable hidden API access.
If your device is running Android 10 or later, run the following ADB command to enable hidden API access.
To revert to the default behavior, just replace put with delete and remove the 1 .
Obviously, these commands aren’t exactly useful for a production app. I can tell you firsthand that properly instructing users on how to use ADB is incredibly difficult. But they can be useful if you need to update an old app to comply with the new restrictions.
Native/JNI workaround
There are two ways you can bypass the hidden API blacklist using JNI in your Android app. One works for Android 9 and 10, and the other works for Android 9 and later.
Android 9 and 10
If you already have a native portion of your app, this will be easy to implement. Just use the JNI_OnLoad() function.
static art::Runtime* runtime = nullptr;
Be aware that this method only works on Android 9 and 10.
Android 9 and later
For any version of Android, you have your choice of two libraries to bypass the hidden API restriction: FreeReflection and RestrictionBypass.
Both are easy to implement and use.
To implement FreeReflection, add the dependency to your module-level build.gradle.
Then override attachBaseContext() in your Application class.
If you don’t have an Application class, you can add it pretty easily. Create a new class that extends Application and then point to it in your AndroidManifest.xml.
To implement RestrictionBypass, add the JitPack repository to your project-level build.gradle.
Then add the dependency to your module-level build.gradle.
And that’s it. This library automatically removes the blacklist restrictions.
Java workaround
While the JNI solutions are effective, there are times you might not want to use native code. If you aren’t already doing things in C++, it can add unnecessary size, along with platform restrictions, to your app. Luckily, there are ways to bypass the hidden API blacklist using only Java.
Android 9 and 10
In Android 9 and 10, you can use what can be called double-reflection or meta-reflection to bypass the hidden API blacklist. Because the system only checks what third-party apps are calling, double-reflection tricks it into thinking the system is making the hidden API calls.
This trick can be used to call a method to give your app hidden API exemptions, aptly named setHiddenApiExemptions() . Simply add the following code somewhere early on in your app’s lifecycle (such as Application’s onCreate() method), and it’ll handle bypassing the blacklist.
If your app is compatible with versions of Android lower than 9, remember to wrap this in a version check.
Android 9 and later
To bypass the hidden API blacklist on Android 9 and any later version, you can use LSPosed’s library. This library uses Java’s Unsafe API, so it’s unlikely to ever break.
To implement it, just add the dependency to your module-level build.gradle.
Then use it to bypass the blacklist.
If your app is compatible with versions of Android lower than 9, remember to wrap this in a version check.
Conclusion and More Info
There are plenty of options for bypassing the hidden API blacklist on Android, no matter which platform version you target or use. If you’re curious to learn more about how these methods and libraries work, be sure to check out the following links.
]]> https://www.xda-developers.com/bypass-hidden-apis/feed/ 0 Advanced Android Development: Elevate app permissions using Shizuku
https://www.xda-developers.com/implementing-shizuku/ https://www.xda-developers.com/implementing-shizuku/#respond
Thu, 07 Oct 2021 14:30:56 +0000
Usage
Checking Availability
Before going into how to use Shizuku, let’s talk about making sure it’s actually available to use.
Before checking to see if the permission is granted, and before making API calls through Shizuku, you can make sure those checks and calls will succeed with the following method:
If Shizuku is installed and running, this will return true. Otherwise, it will return false.
Granting Permission
Since Shizuku uses a runtime permission, it has to be granted to your app before you can do anything with shell access. There are also two API versions in circulation, with different ways of granting it. This section will show you how to handle both.
Checking
Before you request the permission, the best thing to do is to check if you already have it. If you do, you can continue with whatever you need to do. Otherwise, you’ll need to request it before continuing.
To check if you have permission to use Shizuku, you can use the following. This code is assuming you’re running it inside an Activity.
Kotlin:
Java:
Requesting
If you need to request permission to use Shizuku, here’s how.
The SHIZUKU_CODE variable used below should be an integer with a steady value (static variable).
Kotlin:
Java:
To listen for the result, you’ll need to override Activity’s onRequestPermissionsResult() method. You’ll also need to implement Shizuku.OnRequestPermissionResultListener. The example I’m going to show assumes your Activity implements that interface, but you can implement it in a variable if you want.
Kotlin:
Java:
Using APIs
Now that Shizuku is set up and permissions are granted, you can start actually calling APIs using Shizuku. The process here is a little different than you might be used to. Instead of calling getSystemService() and casting to something like WindowManager , you’ll have to use the internal APIs for these instead (e.g., IWindowManager ).
Shizuku includes a bypass for Android’s hidden API blacklist, so you won’t need to worry about that when using it. If you’re curious how to bypass that yourself though, check out my previous tutorial.
Here’s a quick example (using reflection) showing you how you can get an instance of IPackageManager and use it to grant an app a runtime permission.
Kotlin:
Java:
The process for other APIs is similar. Get the references to the class and its Stub sub-class. Get the reference to the asInterface method for the Stub class. Get the references to the methods you want from the class itself. Then, invoke the asInterface method reference you have, replacing «package» above with whatever service you need. That instance can then be passed for method invocations.
Pro-tip: you can avoid using reflection altogether if you install a modified SDK. Check out anggrayudi’s GitHub repository for the modified SDKs and installation instructions. With this installed, the above code (in Kotlin) becomes a whole lot simpler.
Any AIDL-based APIs can be used with this method from anywhere in your app, as long as Shizuku is running and your app has permission.
User Service
While the Binder method covers most use-cases, there may be times where you need an API that doesn’t have a direct Binder interface. In that case, you can use the User Service feature in Shizuku.
This method works similarly to a normal Service in Android. You “start” it, communicate by binding to it with a ServiceConnection, and run your logic in the service class. The difference is you aren’t using Android’s Service, and anything inside the service runs with ADB permissions.
Now there are some limitations. The User Service runs in a completely separate process and user, so you can’t interact with the rest of your app except through your own AIDL callbacks and Binders. Since it’s also not running in a proper app process, some things like binding Android Services may not work properly.
This also requires Shizuku version 10 or later. While most sources for the app have version 11 currently, you should still include a version check, which will be included in the example.
Defining an AIDL
To get started, you’ll need to create a new AIDL file. You can do this in Android Studio by right-clicking anything in the Android file-view, hovering over the “New” option, and choosing the “AIDL” option. Enter the name of the file (e.g., “IUserService”), and Android Studio will create a template file for you.
If you aren’t familiar with how AIDLs work, be sure to check out Google’s documentation.
Remove the template methods from the AIDL and then add a destroy() method with the proper ID for Shizuku. This will be called when Shizuku is killing the User Service, and should be used to clean up any references or ongoing logic you have.
Implementing the AIDL
The next thing to do is actually implement the AIDL.
Java:
Kotlin:
The above examples assume you have the Android Hidden API SDK installed.
Setting up the Service Connection
Now that the User Service is defined and implemented, it’s time to get it set up for use. The first thing you should do is define a ServiceConnection where you want to communicate with it (e.g., from the main Activity in your app).
Java:
Kotlin:
The binder variable is what you’ll be using to communicate with the User Service from your app. To check if it’s available for use, just check that it’s not null and that pingBinder() returns true, just like in the code example above.
Creating the User Service arguments
Before you can control the User Service, you’ll need to define some arguments for Shizuku to use when starting and stopping it. These include things like actually telling Shizuku the class name of the service, specifying the process suffix, whether or not it’s debuggable, and what version it is.
Java:
Kotlin:
Starting, Stopping, and Binding the User Service
The start and bind actions and the stop and unbind actions are unified in Shizuku. There aren’t separate start and bind methods or stop and unbind methods.
Here’s how to start and bind the User Service.
Java:
Kotlin:
Here’s how to stop and unbind the User Service.
Java:
Kotlin:
Invoking the User Service
Once the User Service is started, you can start using it. Simply check whether the binder variable is non-null and pingable, and then make your method call.
Java:
Kotlin:
Conclusion
If you followed through all of that, you should now have a working Shizuku integration. Just remember to tell your users to install Shizuku, and to properly check that Shizuku is available before trying to use it.
]]> https://www.xda-developers.com/implementing-shizuku/feed/ 0 Android Development Basics: How to add Kotlin to an existing Java Android project
https://www.xda-developers.com/add-kotlin-to-app/ https://www.xda-developers.com/add-kotlin-to-app/#respond
Wed, 06 Oct 2021 14:30:50 +0000
https://www.xda-developers.com/?p=461197 https://www.xda-developers.com/add-kotlin-to-app/feed/ 0 Android Development Basics: How to replace AsyncTask with Kotlin’s Coroutines
https://www.xda-developers.com/asynctask-to-coroutines/ https://www.xda-developers.com/asynctask-to-coroutines/#respond
Tue, 05 Oct 2021 14:30:10 +0000
https://www.xda-developers.com/?p=468561 build.gradle , include the following dependencies.
Sync your project, and Kotlin’s coroutines will now be available to use.
Using Coroutines
Implementing a CoroutineScope
In order to use coroutines, you’ll need to have a CoroutineScope instance available. An easy way to do this is to just implement it in your containing class.
For example, to implement a CoroutineScope in an Activity:
This will make SomeActivity implement the CoroutineScope interface by way of the MainScope class. MainScope will handle all implementation logic for CoroutineScope, while allowing you to use the CoroutineScope methods. Calling cancel() in onDestroy() makes sure that no asynchronous logic continues to run after the Activity exits.
Replacing AsyncTask with Coroutines
Say you have an AsyncTask inside an Activity that performs a long-running operation in the background and eventually returns a String. Something like the following.
Replacing this with a coroutine is easy. Just use the async() method. Kotlin’s async() runs on whichever Thread it was launched on, but does it asynchronously. This means you can update Views and such without having to worry about using the right Thread.
As you can see, using coroutines can be a lot simpler than using AsyncTask. You don’t have to just call async() and let it do its thing, though. You can hold a reference to it and even wait for it to finish.
Returning values with async
You can even return a value from async() if you want. So the original example could become something like this.
Using withContext
For convenience, Kotlin provides withContext() . This inlines the whole await() thing and just returns the value to you.
Conclusion
The examples above are just some basic usage of Kotlin’s coroutines to get you started. You don’t have to limit coroutines to Activities or even anything with a proper lifecycle. You can run them basically anywhere. There are also more advanced operations, like choosing which Thread should run the asynchronous logic. This guide is mainly for showing how to replace a simple AsyncTask with a simple coroutine.
For more details on how coroutines work, and how you can make use of their more advanced features, check out the official Kotlin documentation.
]]> https://www.xda-developers.com/asynctask-to-coroutines/feed/ 0 Google starts uploading the Android 12 source code to AOSP
https://www.xda-developers.com/android-12-source-code/ https://www.xda-developers.com/android-12-source-code/#respond
Mon, 04 Oct 2021 20:57:10 +0000
https://www.xda-developers.com/?p=530163 https://www.xda-developers.com/android-12-source-code/feed/ 0 Android Development Basics: How to add View Binding to an Android Gradle project
https://www.xda-developers.com/android-add-view-binding/ https://www.xda-developers.com/android-add-view-binding/#respond
Mon, 04 Oct 2021 14:30:51 +0000
https://www.xda-developers.com/?p=462189 findViewById() method. Pass it an ID of one of the Views in your XML layout and it’ll return a reference to the inflated version of that View. That’s all assuming you passed the right ID though, and that the View actually exists. findViewById() has no checks built in to prevent you from trying to retrieve a View you can’t retrieve. Enter View Binding.
Instead of using findViewById() on each View you want, View Binding automatically generates a binding class for each layout XML. Each View with an ID is automatically added to the class, so you can reference them directly.
Adding View Binding to an Android Gradle project is super simple.
Gradle Setup
View Binding is enabled at the module level in Gradle. If you have multiple modules, you’ll need to enable it individually for each one.
In the android block in your module-level build.gradle , add the option to enable View Binding.
There may be a warning about illegal access, but that’s a lint bug and can be safely ignored.
Sync the project and View Binding will be enabled. It’s that easy.
Using View Binding
There are a few ways to use View Binding, but before any of that happens, let’s talk about how the binding classes are generated.
Class Name Syntax
Say you have a layout XML named some_layout.xml . Its corresponding binding class will be named SomeLayoutBinding . That pattern holds for all files.
Each word (separated by underscores in the file name) will be capitalized, and the underscores will be removed. “Binding” then gets added to the end.
Instantiating with Existing View
If you’ve already inflated the layout file and you have a reference to the root of the layout, you can tell the View binding class to use the existing layout.
Kotlin:
Java:
For example, if you wanted to use the binding class in a Fragment, it would look something like this.
Kotlin:
Java:
Instantiating with New View
The binding class can also take care of inflating the layout for you.
Kotlin:
Java:
This method is useful in both Fragments and Activities.
An example Fragment would look something like the following.
Kotlin:
Java:
An example Activity would look something like the following.
Kotlin:
Java:
Referencing Views
Now that the View binding class is set up and ready to use, it’s time to actually use it.
Let’s say the contents of the some_layout.xml are something like the following:
There are a lot of IDs there to reference in code. But as long as you have the binding class instantiated, referencing will be easy.
In Kotlin, Views are referenced by variables matching their IDs, with some changes. Underscores are removed and the resulting string is camel-cased. For example, to reference some_frame_layout from code, you’d use binding.someFrameLayout . The someFrameLayout variable will be an instance of FrameLayout.
In Java, Views are referenced by getter methods matching their IDs, with a similar format to Kotlin. For example, to reference some_frame_layout , you’d use binding.getSomeFrameLayout() . The method will return an instance of FrameLayout.
The View references are also flattened in the binding. Referencing inner_imageview is the same as referencing some_frame_layout .
Conclusion
As I’m sure you can see, View Binding in Android is both easy to implement and easy to use. In many cases, it’s easier to use than findViewById() .
For more details on implementing View Binding, along with some examples, check out Google’s official documentation.
]]> https://www.xda-developers.com/android-add-view-binding/feed/ 0 Google announces dates for 2021 Android Dev Summit, Chrome Dev Summit, and Firebase Dev Summit
https://www.xda-developers.com/android-dev-summit-chrome-dev-summit-firebase-summit-2021-dates/ https://www.xda-developers.com/android-dev-summit-chrome-dev-summit-firebase-summit-2021-dates/#respond
Wed, 29 Sep 2021 19:37:20 +0000
https://www.xda-developers.com/?p=527083 https://www.xda-developers.com/android-dev-summit-chrome-dev-summit-firebase-summit-2021-dates/feed/ 0 ADB Tips & Tricks: ADB commands that every power user should know about!
https://www.xda-developers.com/adb-tips-tricks/ https://www.xda-developers.com/adb-tips-tricks/#respond
Sat, 25 Sep 2021 11:00:48 +0000
Shell Access
If you’ve used ADB before, you may be used to running commands all in one line. But you can also use ADB to open a terminal shell on your device and run commands directly. And it’s easy!
In your terminal or command prompt window:
You’ll then be greeted with a $ symbol where you can run commands directly on your device.
Listing Installed Apps through ADB
To see the installed apps on your device, you can use the following command:
adb shell pm list packages
This will return a list of the package names of the installed apps, with each one on its own line prepended with package: .
Options
There are also some options you can use to retrieve more specific lists.
- -f will include the path to the base APK for each app, along with its package name.
- -a will make sure all known non-APEX packages are returned.
- -d will cause the command to only return disabled packages.
- -e will cause the command to only return enabled packages.
- -s will cause the command to only return system packages.
- -3 will cause the command to only return third-party packages.
- -i will include the installer package name for each package.
- -U will include the package UID for each package.
- -u will include uninstalled packages.
- –show-versioncode will include the version code for each package.
- –apex-only will only return APEX packages.
- –uid will only show packages with the given UID.
- –user will only show packages belonging to the given user ID.
Installing & Uninstalling Apps through ADB
This is a relatively common use of ADB, but it’s worth mentioning anyway. Among other ways, you can also make use of ADB to install and uninstall Android apps to your Android device.
Installing an APK
If you have an APK on your computer, you can install it to your device with the following:
adb install -r someapk.apk
Remember to replace someapk.apk with the full path to the APK you want to install.
Options
There are a bunch of options for installing APKs through ADB.
- The -r option allows ADB to install over an existing app (i.e., update). On Android Pie and later, you don’t have to specify this option.
- The -R option, for Android Pie and later, will cause the install to fail if the app is already installed.
- The -i option lets you specify an installer package name. This is what gets returned if Android wants to know what installed the APK.
- The -t option allows an APK with android:testOnly=”true” in its manifest to be installed.
- The -d option allows the specified APK to be a downgrade to an already-installed app. This only works if both versions of the app are debuggable.
- The -g option for Android Marshmallow and later automatically grants all runtime permissions to the installed app.
That’s not all of them. If you want a full list, you can check out the built-in documentation.
Multiple APKs and Bundles
If you have a bunch of APKs you want to install at once, either from multiple apps, or because you’re installing an app bundle, you can use ADB’s install-multiple and install-multi-package features.
If all of your APKs are for one app, use install-multiple :
adb install-multiple apk1.apk apk2.apk .
Otherwise, use install-multi-package :
adb install-multi-package app1.apk app2.apk .
The options for these commands are similar to install , but with some limitations. Check out ADB’s built-in documentation for which options are available.
Uninstalling an App
To uninstall using ADB, you’ll need the package name of the app you want to uninstall. Check out the section for Listing Installed Apps if you haven’t already.
Once you have the package name, uninstalling is as simple as:
Note: You generally can’t uninstall system or preinstalled apps using this command. You may be able to disable them with ADB, however. Check out the section Disabling & Enabling almost any App for details.
Extracting APKs with ADB
There are plenty of reasons you might want to extract the APK(s) for an app. Maybe you want to back it up for future use, or maybe it’s no longer available online and you want to transfer it to a different device.
Extracting an app using ADB is pretty simple. First, you’ll want to find the package name of the app you want to extract. There are multiple ways to do this, but the easiest is usually to use your device’s Settings app to view the list of all installed apps, select the one you want, and scroll down until you find the package name or app ID.
Once you have the package name, run the following command:
adb shell pm path
This command will return the path of all APKs for that package name.
You can then use the following command to pull each APK to your computer:
adb pull /path/to/apk.apk
Listing App Components
An app’s components are things like its Activities, BroadcastReceivers, Services, and so on. Sometimes it’s useful to know the names of these components in a specific app, especially if you want to launch hidden Activities or send a broadcast with specific data.
Unfortunately, ADB doesn’t have a very clean way of listing an app’s components. But it is possible. Run the following command:
adb shell dumpsys package
A whole bunch of text will be returned.
- Scroll until you find the Activity Resolver Table title to see the Activities.
- Look under Receiver Resolver Table for BroadcastReceivers.
- Check the Service Resolver Table for Services.
- And so on.
Each component will show the action needed to launch it, the name of the component, and possibly some extra information.
Alternatively, if you want an easier way to see Activities, Services, and Receivers, you can use my Root Activity Launcher app. It will show you those components for each app, along with a bunch of other handy features.
Launching Activities, Services, and BroadcastReceivers
ADB can also be used to launch Activities, start Services, and notify BroadcastReceivers. You can even specify data URIs and Intent extras if needed.
To launch components, you’ll need the component name of what you want to launch. You can see how to get that from the Listing App Components section.
The command syntax for launching an Activity is something like this:
The command syntax for starting a Service is something like this:
am startservice -a -n
The command syntax for notifying a BroadcastReceiver is something like this:
In most cases, for Activities and Services, you don’t need to explicitly specify an action. You’ll usually only need it if the component uses one other than android.intent.action.MAIN.
On top of the basic syntax, here’s how to specify more data to pass. In general, all data values should be enclosed in double quotes.
- -d allows you to specify a data URI.
- -e or –es allows you to specify a String extra.
- –esn allows you to specify a null String extra.
- –ez is used to specify a boolean extra.
- –ei is used to specify an integer extra.
- –el is for specifying a long extra.
- –ef will pass a float extra.
- –eu passes a URI extra.
- –ecn can be used to specify a component name extra.
- –eia , ,… will pass the values as an Integer[] extra.
- –eial , ,… will pass the values as a List .
- The same array and list arguments also work for longs, floats, and Strings. Just replace the i with the appropriate letter.
- -f allows you to specify a flag.
There are even more behavior options you can use, so check out the build in documentation for details.
Disabling & Enabling almost any App
System apps in Android can’t be uninstalled, and a lot of them also can’t be disabled through Settings. While ADB won’t let you uninstall them, it may help you disable them.
First, make sure to get the package name of the app you want to disable. Then, try these commands. If one fails, try the next option.
- pm disable
- To re-enable, use pm enable
pm disable-user –user 0
- To re-enable, use pm enable
- To re-enable, use pm unhide
pm suspend
- To re-enable, use pm unsuspend
pm uninstall -k –user 0
- To re-enable, use pm install-existing
If you’re using multiple user profiles on your device, make sure to replace 0 in the commands above with the actual user ID you have.
ADB is an incredibly powerful tool, and it can do so much more than just what’s above. The commands in this article are just a useful starting point. For more advanced usage, check out commands like cmd -l to see different services you might be able to interact with or ls -l /system/bin to see the different command executables available.
]]> https://www.xda-developers.com/adb-tips-tricks/feed/ 0 Google shares roadmap for the transition to Manifest V3 in Chrome
https://www.xda-developers.com/google-chrome-manifest-v3-transition-details/ https://www.xda-developers.com/google-chrome-manifest-v3-transition-details/#respond
Thu, 23 Sep 2021 17:20:31 +0000
https://www.xda-developers.com/?p=522765 https://www.xda-developers.com/google-chrome-manifest-v3-transition-details/feed/ 0 Google takes action against developer that used sexually explicit ads to promote their game
https://www.xda-developers.com/google-play-removes-game-using-sexually-explicit-ads/ https://www.xda-developers.com/google-play-removes-game-using-sexually-explicit-ads/#respond
Tue, 21 Sep 2021 21:41:40 +0000
https://www.xda-developers.com/?p=521205 https://www.xda-developers.com/google-play-removes-game-using-sexually-explicit-ads/feed/ 0 Android 11’s auto-reset permissions feature is coming to older OS versions
https://www.xda-developers.com/android-11-auto-reset-permissions-coming-to-android-6-0/ https://www.xda-developers.com/android-11-auto-reset-permissions-coming-to-android-6-0/#respond
Fri, 17 Sep 2021 17:00:09 +0000
https://www.xda-developers.com/?p=518753 androidx.core.content.PackageManagerCompat.getUnusedAppRestrictionsStatus() and androidx.core.content.IntentCompat.createManageUnusedAppRestrictionsIntent() . Doing so is helpful for apps that primarily operate in the background, such as a companion app for your smartwatch.
The permission auto-revoke feature making its way to older Android phones may sound insignificant on the surface, but considering that software support for many of these older phones ceased a long time ago and thus are at higher risk of being exploited by malicious apps, it’s good to see Google expanding this privacy feature to older Android versions.
The permission auto-reset feature will gradually roll out to Android 6.0 through Android 10 devices with Google Play Services installed starting December 2021. Google says the feature will reach all eligible devices by Q1 2022. Meanwhile, the cross-platform auto-reset APIs launch today in beta with Jetpack Core 1.7.0 but will launch as a stable API in October 2021.
]]> https://www.xda-developers.com/android-11-auto-reset-permissions-coming-to-android-6-0/feed/ 0 Google Play Services now lets you delete your advertising ID when you opt out of ad personalization
https://www.xda-developers.com/google-play-services-delete-ad-id-opt-out-personalization/ https://www.xda-developers.com/google-play-services-delete-ad-id-opt-out-personalization/#respond
Thu, 16 Sep 2021 17:44:03 +0000
https://www.xda-developers.com/?p=448269 Google > Ads or Settings > Privacy > Advanced > Ads on your Android device. Once you do so, Google Play Services will stop pushing personalized ad recommendations to your device, but apps on your phone will still be able to see the advertising ID. But a recent update on the Play Console Help page reveals that Google Play Services will soon delete the advertising ID when you opt out of interest-based advertising. The update states: “Starting in late 2021, when a user opts out of interest-based advertising or ads personalization, the advertising identifier will not be available. You will receive a string of zeros in place of the identifier.”
After this change goes live, apps on your phone will see a string of zeroes instead of your advertising ID if you disable personalized ads. Google Play Services will also alert all apps that have access to your advertising ID and related data, so that any existing data can be deleted. In a notice shared by developer kdrag0n, Google further reveals that “This Google Play services phased rollout will affect apps running on Android 12 devices starting late 2021 and will expand to affect apps running on devices that support Google Play in early 2022. In July, we will provide more details and an alternate solution to support essential use cases such as analytics and fraud prevention.”
At the moment, we don’t have any information about the alternate solution that Google will introduce for analytics and fraud prevention. We’ll update this post as soon as we learn more.
Thanks to developer kdrag0n for the tip!
Update 1: More details shared during July 2021 policy update
In the company’s latest PolicyBytes video outlining the upcoming policy changes on Google Play, Google shared more details about what’s happening to the advertising ID and its replacement for analytics and fraud prevention.
For starters, Google showed off what the option to delete your advertising ID will look like, a feature that will roll out to Android 12 devices via a Google Play Services update later this year.
The company also updated its support page on the Advertising ID with some new information. For any developers that need to be notified when a user deletes their advertising ID, Google is letting you sign up for the notification system here. Google also says that apps updating their target API level to 31 will need to declare the following permission in their manifest to query the advertising ID:
Some SDKs may already declare this permission, but it should be noted that the Families Policy prohibits the use of the advertising ID. In that case, you must prevent the permission from being merged into your app by including this element in your manifest:
Next, Google has shared some details on the alternate solution for essential use cases such as analytics and fraud prevention. Called app set ID, this ID is a unique identifier for all apps by the same developer on the device. Google calls this a “privacy-friendly option” to correlate usage or actions across a set of apps owned by your organization, and it must not be used for ads personalization or ads measurement, be connected to any Android identifiers or any personal and sensitive data for advertising purposes, and its collection must be disclosed to the user in a “legally adequate privacy notification, including your privacy policy.”
The app set ID SDK will return an ID unique to the calling app itself if the app was installed from a source other than Google Play, if Google Play Services was unable to determine an app’s developer account, or if the app was installed on a device without Play Services installed. The app set ID is cleared automatically if the API hasn’t been accessed by the group of apps sharing the same ID for over 13 month, if the last app from a given set of apps is uninstalled, or if the user factory resets the device. The developer preview of this feature is now live, though Google warns that due to the potential for changes, the app set ID API shouldn’t be used in production apps.
For more information, read the full developer program policy update announced today or watch the “PolicyBytes” video embedded below which summarizes the most significant changes.
Update 2: Now rolling out
Google Play Services is now rolling out the ability to delete your device’s advertising ID, provided your device is running Android 12. One of our tipsters, @panduu221 on Twitter, told us they now have this feature. We checked our own Android 12 device and confirmed that the new “delete advertising ID” page is now visible. The roll out of this feature is likely controlled by a server-side flag, but for what it’s worth, our device has version 21.36.14 of the Google Play Services app.
]]> https://www.xda-developers.com/google-play-services-delete-ad-id-opt-out-personalization/feed/ 0 Apple wins some and loses some in big Epic Games lawsuit
https://www.xda-developers.com/apple-loses-epic-games-lawsuit/ https://www.xda-developers.com/apple-loses-epic-games-lawsuit/#respond
Sun, 12 Sep 2021 20:12:10 +0000
Update 1 (9/10/2021 @ 5:17 PM ET): This article’s headline and content were updated to reflect that Apple’s loss was not as big as it seems, and that it’s not clear if direct alternative in-app payment methods will be allowed under the terms of the injunction.
Update 2 (9/11/2021 @ 6:53 PM ET): Added a statement from Apple SVP and General Counsel Kate Adams.
Update 3 (9/12/2021 @ 4:12 PM ET): Added Epic’s appeal to the U.S. Court of Appeals for the Ninth Circuit.
]]> https://www.xda-developers.com/apple-loses-epic-games-lawsuit/feed/ 0 Flutter 2.5 released with full-screen Android app and Material You support
https://www.xda-developers.com/flutter-2-5-dart-2-14-changes/ https://www.xda-developers.com/flutter-2-5-dart-2-14-changes/#respond
Thu, 09 Sep 2021 18:00:37 +0000
Flutter 2.5
Full Screen in Android
A big change in Flutter 2.5 is better full-screen support for apps running on Android. The update brings the following new immersive modes:
- Lean Back: tap anywhere on screen to display the system overlays.
- Immersive: swipe on the edge of the screen to display the system overlays.
- Immersive Sticky: similar to Immersive but allows the framework to handle the swipe.
- Edge-to-Edge: display application elements behind the translucent system overlays.
New Android edge-to-edge mode: normal mode (left), Edge to Edge mode (center), Edge to Edge with a custom SystemUIOverlayStyle (right). Source: Google.
For more details, check out the pull request on the Flutter GitHub repository.
Material You
Material You is Google’s latest version of Material Design. Also known as Material v3, it’s a pretty major revamp of the Material Design language. There are new shapes, themes, and even dynamic color effects.
Flutter 2.5 introduces some Material You support options, including new FAB sizes and more theming options. It’s not a complete implementation yet, but it shows that Google is making progress.
New Material You FAB sizes. Source: Google.
IDE Plugins
Alongside Flutter 2.5, the IDE plugins for IntelliJ/Android Studio and Visual Studio Code are being updated.
IntelliJ/Android Studio
The new IntelliJ/Android Studio plugin for Flutter allows developers to run integration tests on the entire project. These tests are defined in their own directory and run on-device. You can also now generate coverage reports for unit and integration tests.
Finally, there’s another small addition to let you preview TrueType font icons in the IDE when those fonts are fetched from pub.dev. You have to tell the IDE which packages you’re using, and it only works on static constants, but it’s definitely a nice feature to have.
Visual Studio Code
With the updates to the Visual Studio Code plugin for Flutter, there are two new commands added to make it easier to install Dart and Dart Dev dependencies. There’s also now a Fix All command for automatically formatting and fixing lint issues in the current file.
On top of that, there’s a new test runner for Dart and Flutter code in preview that can be enabled in this version. This new runner will eventually replace the current one.
Pigeon
Pigeon is a code generation tool made for Flutter to help developers with code bridging between Flutter and native platforms. Pigeon uses a special interface descriptor syntax to generate Flutter, Java, and Objective-C stubs automatically. It’s even type-safe and null-safe.
Pigeon 1.0 brings the basic functionality to the stable channel, along with support for better error messages, generics, primitives, and multiple arguments.
Dart 2.14
While there’s a lot new in Flutter itself, the underlying language, Dart, also has some changes.
Apple Silicon
Dart 2.14.1 has better support for Apple Silicon. The Dart SDK for Apple Silicon is now stable, and iOS emulators can be run on ARM64. Unfortunately, the Dart SDK included in the Flutter SDK doesn’t yet natively support Apple Silicon.
Lint Conditions
Dart has gone through a lot of changes since it was first created, including the syntax and style conventions around that syntax. Because of these changes, and old style guides sticking around, there’s been some confusion with how to properly format Dart and Flutter code.
Dart 2.14.1 and Flutter 2.5 now have a set of conditions for lint, and these conditions are applied by default.
Conclusion
There’s a whole lot more that’s new in Flutter 2.5 and Dart 2.14. From bug fixes to new features, this article definitely hasn’t covered everything. Make sure you check out Google’s blog posts on Flutter 2.5 and Dart 2.14 for everything that’s new.
Источник