uses-permission and action - help me understand



  • I understand the situation.

    1. Got it. uses-permission - which should indicate the category (events, equipment, operation) to which the annex needs access (receipt/processing).
    2. Got it. <intent-filter> <action - in which for the specific part of the annex (activity, service, receiver) the filter value for which the specific element of the annex will receive and process the intent.

    Here's the question in a specific example: Service in onCreate Create and record reciver and maintain a normal response to the connection/deactivation of the harbour (sam service is pre-launched by another annex)

    myReceiver = new MyReceiver();
    IntentFilter intentFilter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
    registerReceiver(myReceiver, intentFilter);
    

    but it is necessary to start the service without the use of the side application (involved the garment, the service should start). For this end, record action in the manifest, but not getting the desired result.

    <intent-filter android:priority="2147483647">             
    <action android:name="android.intent.action.HEADSET_PLUG" />
    

    I think it's right to know that this is the case. uses-permissionbut that's what he's got the correct meaning of where I can't find him.

    It looks like a manifesto after adjustments to the first reply.

    <?xml version="1.0" encoding="utf-8"?>
    

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    

    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.RECEIVE_HEADSET_PLUG" />

    <uses-permission android:name="android.permission.RECEIVE_SMS" />
    <uses-permission android:name="android.permission.READ_SMS" />
    <uses-permission android:name="android.permission.SEND_SMS" />

    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".Main">
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>

    &lt;receiver
        android:name="com.example.kiril.micvol.SmsReceiver"
        android:enabled="true"
        android:exported="true"
        android:permission="android.permission.BROADCAST_SMS"
        android:process=":service"&gt;
        &lt;intent-filter android:priority="2147483647"&gt;
            &lt;action android:name="android.provider.Telephony.SMS_RECEIVED" /&gt;
            &lt;action android:name="android.provider.Telephony.SMS_DELIVER" /&gt;
            &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
        &lt;/intent-filter&gt;
    &lt;/receiver&gt;
    
    &lt;receiver android:name="com.example.kiril.micvol.MyReceiver"
        android:enabled="true"
        android:exported="true"
        android:permission="android.permission.RECEIVE_HEADSET_PLUG"
        android:process=":service"&gt;
        &lt;intent-filter android:priority="2147483647"&gt;
            &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
            &lt;action android:name="android.intent.action.HEADSET_PLUG" /&gt;
        &lt;/intent-filter&gt;
    &lt;/receiver&gt;
    
    &lt;service
        android:name="com.example.kiril.micvol.MyService"
        android:enabled="true"
        android:exported="true"
        android:process=":service"&gt;
        &lt;intent-filter&gt;
            &lt;action android:name="com.example.kiril.micvol" /&gt;
            &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
        &lt;/intent-filter&gt;
    &lt;/service&gt;
    

    </application>



    1. The recorder shall be recorded in the manifest so that may receive communications without need in the present annex.
    2. In order for the reciver to be registered by the notification system, the annex must be launched once.
    3. In order to continue to respond to messages after rebooting the device, the annex shall be started at the end of the device.
    4. To this end, it shall have a reciver in the manifest when the device is downloaded.

    Total:

    1. The annex should catch the event of the launch.
    2. All recivers should be in the manifest.
    3. The annex must be launched once by a laser.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2