Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically Read Debug state in Manifest

I want to read the debug state in the Android manifest file and then fire off a method or not based on that state. I see you can read the XML file and parse it but that way seems not that elegant. Is there another way, is that information of whats in the Manifest stored in a Java object somewhere?

<application android:name=".MyActivity" android:icon="@drawable/myicon"
    android:label="@string/app_name" android:debuggable="true">
like image 393
JPM Avatar asked Nov 11 '11 17:11

JPM


People also ask

What is the purpose of AndroidManifest XML?

Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

Where is AndroidManifest XML located?

When you build an Android app by using Quantum Visualizer, an AndroidManifest. xml file is created in the app's corresponding dist folder. The file is located at WorkspaceName>/temp/<AppName>/build/luaandroid/dist.

What does AndroidManifest XML file contains?

The AndroidManifest. xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.

How do I change AndroidManifest XML?

Open your Android project and go to <AppProjectFolder>/app/src/main/. Open the app manifest file AndroidManifest. xml and add the following lines to the file as child elements of the <manifest> element. Note: You must include the QUERY_ALL_PACKAGES permission if your app targets Android 11 (API Level 30) or higher.


1 Answers

boolean DEBUGGABLE = (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
like image 80
HandlerExploit Avatar answered Sep 23 '22 16:09

HandlerExploit