Was soll das bedeuten ? does not require android.permission.BIND_JOB_SERVICE permission

Joob

Top Contributor
Ich habe bei coding in flow versucht einen scheduler nachzubauen da ich nach einem geeigneten Backgroundservice suche.

Obwohl ich alles dreimal überprüft habe und keinen Fehler finden konnte bekomme ich die folgende Exception


Code:
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.traincounter.jupp.vtmobil, PID: 5223
    java.lang.IllegalArgumentException: Scheduled service ComponentInfo{com.traincounter.jupp.vtmobil/com.traincounter.jupp.vtmobil.SYS.OTimeService} does not require android.permission.BIND_JOB_SERVICE permission
        at android.os.Parcel.readException(Parcel.java:2008)
        at android.os.Parcel.readException(Parcel.java:1950)
        at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:180)
        at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:44)
        at com.traincounter.jupp.vtmobil.MainActivity$1.onClick(MainActivity.java:235)
        at android.view.View.performClick(View.java:6294)
        at android.view.View$PerformClick.run(View.java:24770)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

in der letzten Zeile :

Code:
ComponentName COTimeService = new ComponentName ( MainActivity.this, com.traincounter.jupp.vtmobil.SYS.OTimeService.class );

JobInfo infoOT = new JobInfo.Builder ( 0000, COTimeService )

        .setRequiresCharging ( true )

        .setRequiredNetworkType ( JobInfo.NETWORK_TYPE_UNMETERED )

        .setPersisted ( true )

        .setPeriodic ( 15 * 60 * 1000 )

        .build ();


JobScheduler schedulerOT = (JobScheduler) getSystemService ( JOB_SCHEDULER_SERVICE ) ;


int resultOT = schedulerOT.schedule ( infoOT );

Ich habe auch die Lösungen bei StackOverFlow versucht,
aber einerseits weiß ich nicht was das Einfügen der Zeile

android:exported="true"

für Konsequenzen hat und außerdem hat das auch nicht zu einer Lösung geführt.

Mein Manifest sieht so aus:
Code:
<?xml version="1.0" encoding="utf-8"?>

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.traincounter.jupp.vtmobil">

    <!-- Wichtig für Internetzugriff mit php und ftp -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:allowBackup="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".A0000_SpeechSelector"></activity>
        <activity android:name=".A1000_GeneralSelector"></activity>
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- Deklarieren der Services -->
        <!--<service android:name=".SYS.TimerService" />-->
        <service android:name=".SYS.OTimeService"
            android:exported="true"
            android:permission="andriod.permission.BIND_JOB_SERVICE"/>

    </application>

</manifest>
 

mihe7

Top Contributor
Was passiert denn, wenn Du das ohne
Code:
      android:permission="andriod.permission.BIND_JOB_SERVICE"
laufen lässt?
 

Joob

Top Contributor
Kommt noch immer die gleiche Meldung.

Code:
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.job.vt, PID: 4065
    java.lang.IllegalArgumentException: Scheduled service ComponentInfo{com.job.vt/com.job.vt.sys.TimerServicePlan} does not require android.permission.BIND_JOB_SERVICE permission
        at android.os.Parcel.readException(Parcel.java:2008)
        at android.os.Parcel.readException(Parcel.java:1950)
        at android.app.job.IJobScheduler$Stub$Proxy.schedule(IJobScheduler.java:180)
        at android.app.JobSchedulerImpl.schedule(JobSchedulerImpl.java:44)
        at com.job.vt.MainActivity.startOTscheduler(MainActivity.java:464)
        at com.job.vt.MainActivity.checkLoginData(MainActivity.java:251)
        at com.job.vt.MainActivity.access$200(MainActivity.java:43)
        at com.job.vt.MainActivity$1.onClick(MainActivity.java:120)
        at android.view.View.performClick(View.java:6294)
        at android.view.View$PerformClick.run(View.java:24770)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6494)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

mit diesem Manifest

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

<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.job.vt">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!--before access to hoster you must check state with connectivity Manager-->
<uses-permission android:name="android.permission.INTERNET" /> <!--access hoster-->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <!--scheduler-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!--schreiben auf SD Card-->
<!--<uses-permission android:name="android.permission.READ_PHONE_STATE" />-->

<application
android:name=".AppStarter"
android:allowBackup="true"
android:networkSecurityConfig="@xml/network_security_config"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".A0000_SpeechSelector"></activity>
<activity android:name=".A1000_GeneralSelector"></activity>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Deklarieren der Services -->
<service android:name=".sys.TimerService" />
<service android:name=".sys.TimerServicePlan"/>

<!--android:permission="andriod.permission.BIND_JOB_SERVICE"/>-->

</application>

</manifest>
Code:
<?xml version="1.0" encoding="utf-8"?>

<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.job.vt">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />                      <!--before access to hoster you must check state with connectivity Manager-->
    <uses-permission android:name="android.permission.INTERNET" />                                  <!--access hoster-->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />                    <!--scheduler-->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />                    <!--schreiben auf SD Card-->
    <!--<uses-permission android:name="android.permission.READ_PHONE_STATE" />-->

    <application
        android:name=".AppStarter"
        android:allowBackup="true"
        android:networkSecurityConfig="@xml/network_security_config"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".A0000_SpeechSelector"></activity>
        <activity android:name=".A1000_GeneralSelector"></activity>
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- Deklarieren der Services -->
        <service android:name=".sys.TimerService" />
        <service android:name=".sys.TimerServicePlan"/>

            <!--android:permission="andriod.permission.BIND_JOB_SERVICE"/>-->

    </application>

</manifest>

Wie kann das denn sein ?
 

Joob

Top Contributor
Recht herzlichen Dank, Super.

Ich hätte das nicht mehr gesehen.
Was soll ich sagen : Schönen Dank das Du dich darum gekümmert hast.

Ich war schon verzweifelt, bin gerade mit Android neu angefangen und will eine App zu einer Desktopanwendung schreiben
und die Probleme sind noch vielfältig.
 

Neue Themen


Oben