Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Using PackageManager you can query Activities/etc on the system in all installed packages(APKs). The ApiDemos sample code in the Android SDK uses this in the class <code>com.example.android.apis.ApiDemos</code>.</p> <p>Code example:</p> <pre><code>void findAddOnActivities() { Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory("myPackage.intent.category.ADDON"); PackageManager pm = getPackageManager(); List&lt;ResolveInfo&gt; list = pm.queryIntentActivities(mainIntent, 0); // list contains all activities that match your filters in mainIntent } </code></pre> <p>Manifest snippet:</p> <pre><code> &lt;activity android:label="My external Add-on" android:name=".addons.TestAddon" &gt; &lt;intent-filter &gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="myPackage.intent.category.ADDON" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>For Database access and managing access/modify security: Declare your own permissions in your manifest:</p> <pre><code>&lt;permission android:name="com.mycompany.myapp.database.permission.READ" android:label="@string/read_permission" android:protectionLevel="signatureOrSystem"&gt;&lt;/permission&gt; &lt;permission android:name="com.mycompany.myapp.database.permission.WRITE" android:label="@string/write_permission" android:protectionLevel="signatureOrSystem"&gt;&lt;/permission&gt; </code></pre> <p>The protectionLevel tag will make sure that only APKs that are part of the image or are signed with the same key as the main app can be granted that permission.</p> <p>There are many ways to have the addon access your database. A remote service or providing an interface would work. In the app I have that does this, my main app has a class called DBManager that already does a bunch of read/writes to the database. So I just use that class in my external App and it can do all the reads/writes since the packages are signed with the same key.</p> <p>If you don't want to use the same key to sign packages, consider using a remote service like the one in the sample code <a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/RemoteService.html">RemoteService.java</a>. Look at the <a href="http://developer.android.com/guide/topics/fundamentals/services.html">android service dev guide</a> for more details. I'm no expert on android Services, so any feedback from others would probably be helpful.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload