我正在尝试请求
if (ActivityCompat.checkSelfPermission(mContext, Manifest.permission_group.LOCATION) != PackageManager.PERMISSION_GRANTED) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
ActivityCompat.requestPermissions((Activity) mContext, new String[]{Manifest.permission_group.LOCATION}, REQUEST_CODE_ASK_PERMISSIONS);
}
}
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,this);
我收到此错误
03-14 15:57:30.050 29841-29841/com.ativaishna.av.audb W/System.err: java.lang.ClassCastException: android.app.Application cannot be cast to android.app.Activity
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at com.ativaishna.av.audb.service.TeleService.onStartCommand(TeleService.java:50)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3028)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at android.app.ActivityThread.-wrap17(ActivityThread.java)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1452)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at android.os.Looper.loop(Looper.java:148)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5443)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at java.lang.reflect.Method.invoke(Native Method)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
03-14 15:57:30.083 29841-29841/com.ativaishna.av.audb W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
请帮忙